title: Device Doesn't Receive message from NEW Google Cloud Messaging (NEW GCM)
body: <p>please help me
  i've been surfing about this topic , and still stack in this new GCM</p>
  
  <p>my last project using GCM Push according this link</p>
  
  <p>ht**://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/</p>
  
  <p>but now, the last GCM (C2DM) is deprecated, so we don't use any GCMRegistrar anymore </p>
  
  <p>here, take a look at this
  h**p://developer.android.com/google/gcm/c2dm.html
  there is a statement "Android Cloud to Device Messaging (C2DM) is deprecated. The C2DM service will continue to be maintained in the short term, but <strong>C2DM will accept no new users, and it will grant no new quotas</strong>"</p>
  
  <p>i use this link for learning the concept 
  </p>
  
  <p>and for the example i use :
  <a href="https://code.google.com/p/gcm/source/browse/#git" rel="nofollow">https://code.google.com/p/gcm/source/browse/#git</a></p>
  
  <p>i think, i have followed every steps required</p>
  
  <p>i have referenced my project to google play service lib</p>
  
  <p>i also have changed my sender id to my google project number</p>
  
  <p>i also have received RegID from GCM</p>
  
  <p>but the problem is , whenever i click the send button</p>
  
  <p>it never show me anything </p>
  
  <p>from google documentation example, it says that it should ECHO back to my device, but it never does</p>
  
  <p>i checked in documentation
  the concept says that gcmbroadcastreceiver will receive any GCM Message pushed to my device , </p>
  
  <p>so i tried to log inside the "OnReceive" in that broadcaster, 
  but it never show anything</p>
  
  <p>i also tried to implement HTTP GCM Server using this documentation 
  <a href="http://developer.android.com/google/gcm/http.html" rel="nofollow">http://developer.android.com/google/gcm/http.html</a></p>
  
  <p>i get the response like this 
  {"multicast_id":6256370624066466203,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1378114688323559%eab45603f9fd7ecd"}]}</p>
  
  <p>but my log never shows anything</p>
  
  <p>here is my broadcastreceiver</p>
  
  <pre><code>public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          Log.v("HAHA BANGET","masuk ke broadcastReceiver");
  
          // Explicitly specify that GcmIntentService will handle the intent.
          ComponentName comp = new ComponentName(context.getPackageName(),
                  GcmIntentService.class.getName());
          // Start the service, keeping the device awake while it is launching.
          startWakefulService(context, (intent.setComponent(comp)));
          setResultCode(Activity.RESULT_OK);
      }
  }
  </code></pre>
  
  <p>and here is my intentservice</p>
  
  <pre><code>public class GcmIntentService extends IntentService {
      public static final int NOTIFICATION_ID = 1;
      private NotificationManager mNotificationManager;
      NotificationCompat.Builder builder;
  
      public GcmIntentService() {
          super("7134XXXXX");
      }
      public static final String TAG = "HAHA";
  
      @Override
      protected void onHandleIntent(Intent intent) {
  
          Log.v(TAG,"MASUK INTENT NIH");
  
          Bundle extras = intent.getExtras();
          GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
          // The getMessageType() intent parameter must be the intent you received
          // in your BroadcastReceiver.
          String messageType = gcm.getMessageType(intent);
  
          if (!extras.isEmpty()) {  // has effect of unparcelling Bundle
              /*
               * Filter messages based on message type. Since it is likely that GCM will be
               * extended in the future with new message types, just ignore any message types you're
               * not interested in, or that you don't recognize.
               */
              if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
                  sendNotification("Send error: " + extras.toString());
              } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
                  sendNotification("Deleted messages on server: " + extras.toString());
              // If it's a regular GCM message, do some work.
              } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
                  // This loop represents the service doing some work.
                  for (int i = 0; i &lt; 5; i++) {
                      Log.i(TAG, "Working... " + (i + 1)
                              + "/5 @ " + SystemClock.elapsedRealtime());
                      try {
                          Thread.sleep(5000);
                      } catch (InterruptedException e) {
                      }
                  }
                  Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
                  // Post notification of received message.
                  sendNotification("Received: " + extras.toString());
                  Log.i(TAG, "Received: " + extras.toString());
              }
          }
          // Release the wake lock provided by the WakefulBroadcastReceiver.
          GcmBroadcastReceiver.completeWakefulIntent(intent);
      }
  
      // Put the message into a notification and post it.
      // This is just one simple example of what you might choose to do with
      // a GCM message.
      private void sendNotification(String msg) {
          mNotificationManager = (NotificationManager)
                  this.getSystemService(Context.NOTIFICATION_SERVICE);
  
          PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                  new Intent(this, PushBaruLagi.class), 0);
  
          NotificationCompat.Builder mBuilder =
                  new NotificationCompat.Builder(this)
          .setSmallIcon(R.drawable.common_signin_btn_icon_dark)
          .setContentTitle("GCM Notification")
          .setStyle(new NotificationCompat.BigTextStyle()
          .bigText(msg))
          .setContentText(msg);
  
          mBuilder.setContentIntent(contentIntent);
          mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
      }
  }
  </code></pre>
  
  <p>and here is my manifest</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
  
  &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
  &lt;permission android:name="com.coba.pushgcmbaru.permission.C2D_MESSAGE"
      android:protectionLevel="signature" /&gt;
  &lt;uses-permission android:name="com.coba.pushgcmbaru.permission.C2D_MESSAGE" /&gt;
  
  
  &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
  
      &lt;receiver
          android:name="com.coba.pushgcmbaru.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;category android:name="com.coba.pushgcmbaru" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;service android:name="com.coba.pushgcmbaru.GcmIntentService" /&gt;
  
      &lt;activity
          android:name="com.coba.pushgcmbaru.PushBaruLagi"
          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;/application&gt;
  </code></pre>
  
  <p>i'm using 2.2 FROYO</p>
  
  <p>and i've updated my google play services to the newest one</p>
  
  <p>so guys, if anyone could please help me , thanks a lot :)</p>