title: GCM - Can't Receive Messages when Application is destroyed
body: <p>I am working on GCM I deployed GCM in my Application and it worked fine as it should, but that was a previous build now that I have some understanding of GCM I tried to integrate GCM on my new build. But I have encountered a strange issue perhaps it is something obvious that I am missing. But now I don't receive messages when application is destroyed (I am receiving messages when app is in foreground or in background). Also the older version is still receiving messages.</p>
  
  <p>I have added receiver and services in manifest file.</p>
  
  <pre><code>    &lt;receiver
          android:name="com.google.android.gms.gcm.GcmReceiver"
          android:exported="true"
          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.jadoo.jadooplus.gcm" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;service
          android:name="com.jadoo.jadooplus.gcm.PromotionalListenerService"
          android:exported="false" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;service
          android:name="com.jadoo.jadooplus.gcm.services.MyInstanceIDListenerService"
          android:exported="false"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.gms.iid.InstanceID"/&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;service
          android:name="com.jadoo.jadooplus.gcm.services.RegistrationIntentService"
          android:exported="false"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p>But I still can't receive messages. I have checked for incoming messages using Log but onMessageReceived is never invoked.</p>
  
  <p>Here is my ListenerService</p>
  
  <pre><code>public class PromotionalListenerService extends GcmListenerService {
  
  @Override
  public void onMessageReceived(String from, Bundle data) {
  
      Log.d("Listener", "data=" + String.valueOf(data));
  
      if (from.startsWith("/topics/")) {
  
          //  topics messages
          if (Config.isActivityActive) {
              Intent messageReceived = new Intent(GcmConfig.MESSAGE_RECEIVED);
              messageReceived.putExtra(GcmConfig.MESSAGE_LABEL, data);
              LocalBroadcastManager.getInstance(this).sendBroadcast(messageReceived);
          }
          else {
              //  Show a notification
              sendNotification(data);
          }
  
      }
  }
  </code></pre>
  
  <p>Note: Please don't confuse this with Force Stopping an application.</p>