title: GCM implement failed
body: <p>I have big problem. 
  I create server api-key like at google documentation. Create IntentService and BroadcastReceiver. I put my RegistrationId on my server, but I don't receive push-message from google server.
  This my code, can you tell me, what I do wrong?
  IntentService:</p>
  
  <pre><code>public class GcmIntentService extends IntentService{
  Context context;
  public static final int NOTIFICATION_ID = 1;
  private NotificationManager mNotificationManager;
  NotificationCompat.Builder builder;
  public static final String TAG = "GCM Demo";
  
  public GcmIntentService() {
      super(SENDER_ID);//"GcmIntentService");//
      // TODO Auto-generated constructor stub
  }
  
  @Override
  protected void onHandleIntent(Intent intent) {
      // TODO Auto-generated method stub
      Bundle extras = intent.getExtras();
      String msg = intent.getStringExtra("message");
      GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
      String messageType = gcm.getMessageType(intent);
  
       if (!extras.isEmpty()) {
  
           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(500);
                      } catch (InterruptedException e) {
                      }
                  }
                  Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
                  // Post notification of received message.
                  //sendNotification("Received: " + extras.toString());
                  sendNotification(msg);
                  Log.i(TAG, "Received: " + extras.toString());
              }
          }
       GcmBroadcastReceiver.completeWakefulIntent(intent);
  }
  private void sendNotification(String msg) {
      mNotificationManager = (NotificationManager)
              this.getSystemService(Context.NOTIFICATION_SERVICE);
  
      Intent myintent = new Intent(this, ReceiveActivity.class);
      myintent.putExtra("message", msg);
      PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
              //new Intent(this, BaseActivity.class), 0);
              myintent, PendingIntent.FLAG_UPDATE_CURRENT);
  
      NotificationCompat.Builder mBuilder =
              new NotificationCompat.Builder(this)
      .setSmallIcon(R.drawable.ic_stat_gcm)
      .setContentTitle("GCM Notification")
      .setStyle(new NotificationCompat.BigTextStyle()
      .bigText(msg))
      .setContentText(msg);
  
      mBuilder.setContentIntent(contentIntent);
      mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
  }
  </code></pre>
  
  <p>}</p>
  
  <p>BroadCast:</p>
  
  <pre><code>public class GcmBroadcastReceiver extends WakefulBroadcastReceiver{
  
  @Override
  public void onReceive(Context context, Intent intent) {
      // TODO Auto-generated method stub
  
      // 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>}</p>
  
  <p>manifest:</p>
  
  <pre><code>package="*.*"
  android:versionCode="329"
  android:versionName="1.0.3"
  android:installLocation="auto"&gt;
  &lt;uses-sdk android:minSdkVersion="8"
      android:targetSdkVersion="19" /&gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;  
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&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.CHANGE_NETWORK_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&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;permission android:name="*.*.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt;
  &lt;uses-permission android:name="*.*.gcm.permission.C2D_MESSAGE" /&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;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
      &lt;receiver
          android:name="*.*.cgm.GcmBroadcastReceiverCompat"
          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="*.*.cgm" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;activity android:name=".screens.StartingActivity" android:screenOrientation="portrait" 
          android:theme="@android:style/Theme.NoDisplay"&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;service android:name="*.*.cgm.GcmIntentService" /&gt;
  ...
  </code></pre>
  
  <p>Best Regards.</p>