title: how to define manifest file in order to use GCM services
body: <p>i am beginner all around the using of the Google cloud messages api, and i have a problem that i succeed to send the message but i am not get it on my device.
  i saw that some manifest contain section of "" should i use that?</p>
  
  <p>this is the GCM server:</p>
  
  <pre><code>   &lt;?php
  
  class GCM {
  
      function __construct() {
  
      }
      /**
       * Sending Push Notification
       */
      public function send_notification($registatoin_ids, $message) {
          // include config
          include_once 'connection.php';
  
          // Set POST variables
          $url = 'https://android.googleapis.com/gcm/send';
  
          $fields = array(
              'registration_ids' =&gt; $registatoin_ids,
              'data'             =&gt; array("message" =&gt; $message),
          );
  
          $headers = array(
              'Authorization: key=' .GOOGLE_API_KEY,
              'Content-Type: application/json'
          );
          // Open connection
          $ch = curl_init();
  
          // Set the url, number of POST vars, POST data
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
          curl_setopt($ch, CURLOPT_POST, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
          // Disabling SSL Certificate support temporarly
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  
          curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
  
          // Execute post
          $result = curl_exec($ch);
          if ($result === FALSE) {
              die('Curl failed: ' . curl_error($ch));
          }
  
          // Close connection
          curl_close($ch);
          echo $result;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>this is the manifest file:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.matant.gpsportclient"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="16" /&gt;
  
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true" /&gt;
  
      &lt;permission
          android:name="com.example.matant.gpsportclient.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
      &lt;!-- GCM requires a Google account. --&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
      &lt;!--
   The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
           Google Maps Android API v2, but are recommended.
      --&gt;
  
      &lt;!-- Keeps the processor from sleeping when a message is received. --&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
      &lt;!-- Permission to vibrate --&gt;
      &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  
      &lt;uses-permission android:name="android.permission.MANAGE_DOCUMENTS" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
  
  
  
  
  
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="com.example.matant.gpsportclient.permission.MAPS_RECEIVE" /&gt;
  
      &lt;android:uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  
  
  
      &lt;!-- Creates a custom permission so only this app can receive its messages. --&gt;
      &lt;permission
          android:name="com.example.matant.gpsportclient.permission.C2D_MESSAGE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="com.galaxystech.pushnotifications.permission.C2D_MESSAGE" /&gt;
  
      &lt;!-- This app has permission to register and receive data message. --&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  
      &lt;!-- Network State Permissions to detect Internet status --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  
      &lt;!-- Permission to vibrate --&gt;
      &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".SplashScreen"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;receiver
              android:name="com.google.android.gcm.GCMBroadcastReceiver"
              android:permission="com.google.android.c2dm.permission.SEND" &gt;
              &lt;intent-filter&gt;
  
                  &lt;!-- Receives the actual messages. --&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
                  &lt;!-- Receives the registration id. --&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
  
                  &lt;category android:name="com.androidhive.pushnotifications" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
          &lt;service android:name=".GCMIntentService" /&gt;
          &lt;activity
              android:name=".Controllers.ForgotPassword"
              android:label="@string/app_name" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Controllers.Login"
              android:label="@string/title_activity_login" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Controllers.SignUp"
              android:label="@string/title_activity_sign_up" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".MainScreen"
              android:label="@string/title_activity_main_screen" &gt;
          &lt;/activity&gt;
  
          &lt;meta-data
              android:name="com.google.android.gms.version"
              android:value="@integer/google_play_services_version" /&gt;
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="@string/google_maps_key" /&gt;
  
          &lt;activity
              android:name=".Controllers.InviteUsersActivity"
              android:label="@string/title_activity_invite_users" &gt;
          &lt;/activity&gt;
  
          &lt;uses-library android:name="com.google.android.maps" /&gt;
  
          &lt;activity
              android:name=".GoogleCloudNotifications.GCMMessageView"
              android:label="@string/title_activity_gcmmessage_view" &gt;
          &lt;/activity&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>and this is the GCMhandler:</p>
  
  <pre><code>    package com.example.matant.gpsportclient.GoogleCloudNotifications;
  
  /**
   * Created by matant on 10/28/2015.
   */
  import java.util.Timer;
  import java.util.TimerTask;
  
  import android.app.Notification;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.os.PowerManager;
  import android.util.Log;
  
  import com.example.matant.gpsportclient.R;
  import com.google.android.gcm.GCMBaseIntentService;
  
  
  public class GCMIntentService extends GCMBaseIntentService {
  
      private static final String TAG = "GCM Tutorial::Service";
  
      // Use your PROJECT ID from Google API into SENDER_ID
      public static final String SENDER_ID = "84627XXXXXXX";
  
      public GCMIntentService() {
          super(SENDER_ID);
      }
  
      @Override
      protected void onRegistered(Context context, String registrationId) {
  
          Log.i(TAG, "onRegistered: registrationId=" + registrationId);
      }
  
      @Override
      protected void onUnregistered(Context context, String registrationId) {
  
          Log.i(TAG, "onUnregistered: registrationId=" + registrationId);
      }
  
      @Override
      protected void onMessage(Context context, Intent data) {
          String message;
          // Message from PHP server
          message = data.getStringExtra("message");
          // Open a new activity called GCMMessageView
          Intent intent = new Intent(this, GCMMessageView.class);
          // Pass data to the new activity
          intent.putExtra("message", message);
          // Starts the activity on notification click
          PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent,
                  PendingIntent.FLAG_UPDATE_CURRENT);
          // Create the notification with a notification builder
          Notification notification = new Notification.Builder(this)
                  .setSmallIcon(R.drawable.gpsport_logo_icon)
                  .setWhen(System.currentTimeMillis())
                  .setContentTitle("Android GCM Tutorial")
                  .setContentText(message).setContentIntent(pIntent)
                  .getNotification();
          // Remove the notification on click
          notification.flags |= Notification.FLAG_AUTO_CANCEL;
  
          NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
          manager.notify(R.string.app_name, notification);
  
          {
              // Wake Android Device when notification received
              PowerManager pm = (PowerManager) context
                      .getSystemService(Context.POWER_SERVICE);
              final PowerManager.WakeLock mWakelock = pm.newWakeLock(
                      PowerManager.FULL_WAKE_LOCK
                              | PowerManager.ACQUIRE_CAUSES_WAKEUP, "GCM_PUSH");
              mWakelock.acquire();
  
              // Timer before putting Android Device to sleep mode.
              Timer timer = new Timer();
              TimerTask task = new TimerTask() {
                  public void run() {
                      mWakelock.release();
                  }
              };
              timer.schedule(task, 5000);
          }
  
      }
  
      @Override
      protected void onError(Context arg0, String errorId) {
  
          Log.e(TAG, "onError: errorId=" + errorId);
      }
  }
  </code></pre>
  
  <p>this is the result that i got from the server:</p>
  
  <pre><code>"multicast_id":7010046538768109204,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1446032848127257%e63ae1e0f9fd7ecd"}]"
  </code></pre>