title: can't receive messages on device using GCM
body: <p>i've followed google instruction on initiating a gcm server and client. 
  my problem is though i get a successful gcm from server :</p>
  
  <blockquote>
    <p>MulticastResult(multicast_id=8287827393174436535,total=1,success=1,failure=0,canonical_ids=0,results:
    [[ messageId=0:1366468335181772%8e1522ac00000031 ]]</p>
  </blockquote>
  
  <p>i'm not able to see any movement of receiving a message on the client - onMessage() isn't called. 
  client id as well as server id are correct as far as i can tell.</p>
  
  <p>i'd appreciate any help... :)</p>
  
  <p><strong>the server side code :</strong> </p>
  
  <pre><code>try {
  
  Sender sender = new Sender(API_KEY);
  Message message = new Message.Builder().collapseKey("1")
          .timeToLive(3)
          .delayWhileIdle(true)
          .addData("message",
                  "this text will be seen in notification bar!!").build();
  
  ArrayList&lt;String&gt; devices = new ArrayList&lt;String&gt;();
  
  devices.add(DEVICE_ID1); 
  //devices.add(DEVICE_ID2);
  
  MulticastResult result = sender.send(message, devices, 2);
  //Result result = sender.send(message, DEVICE_ID1, 2);
  System.out.println(result.toString());
  if (result.getResults() != null) {
      int canonicalRegId = result.getCanonicalIds();
      if (canonicalRegId != 0) {
      }
  } else {
      int error = result.getFailure();
      System.out.println(error);
  }
  } catch (Exception e) {
      // TODO: handle exception
  }
  </code></pre>
  
  <p><strong>the client code :</strong> 
  <strong>registering :</strong></p>
  
  <pre><code>GCMRegistrar.checkDevice(this);
          GCMRegistrar.checkManifest(this);
          final String regId = GCMRegistrar.getRegistrationId(this);
          if (regId.equals("")) {
            GCMRegistrar.register(this, SENDER_ID); // Note: get the sender id from configuration.
            String regIdString = GCMRegistrar.getRegistrationId(this);
            Log.v(TAG, "RegisterId, regId: " + regIdString);
          } else {
  
            Log.v(TAG, "Already registered, regId: " + regId);
          }
  </code></pre>
  
  <p><strong>and gcmIntentServiceCreated (partly) :</strong> </p>
  
  <pre><code>public class GCMIntentService extends GCMBaseIntentService {
  public GCMIntentService(){
          super(SENDER_ID);       
      }
  @Override
      protected void onMessage(Context context, Intent intent) {
           Log.i("Registration", "Got a message!");
               Log.i("Registration", context.toString() + " " + intent.toString());
      }
  ...
  }
  </code></pre>
  
  <p><strong>client's manifest :</strong> </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.myapp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
      &lt;permission android:protectionLevel="signature" android:name="com.example.myapp.permission.C2D_MESSAGE"&gt;&lt;/permission&gt;
      &lt;uses-permission android:name="com.example.myapp.permission.C2D_MESSAGE"/&gt;
      &lt;!-- App receives GCM messages. --&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
      &lt;!-- GCM connects to Google Services. --&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;!-- Keeps the processor from sleeping when a message is received. --&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.myapp.MainActivity"
              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;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
              &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
              &lt;category android:name="com.example.myapp" /&gt;
            &lt;/intent-filter&gt;
          &lt;/receiver&gt;
          &lt;service android:name=".GCMIntentService" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>