title: Error broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.flagg327.guicomaipu (has extras) }
body: <p>I'm receiving that error from Android Studio's Android Monitor. This error appears when I send a push notification through GCM, in a real device, and the app has not been started yet or has been forced to stop. Yesterday all works fine, today is not working at all (works only if the app is running in background or foreground).</p>
  
  <p>I think this may be an <code>AndroidManifest</code> error, but I'm tired of looking for the problem and can not find anything.</p>
  
  <p><strong>Manifest</strong></p>
  
  <pre><code>&lt;manifest 
      xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.flagg327.guicomaipu"&gt;
  
      ...
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
          ...
  
          &lt;!--GOOGLE CLOUD MESSAGE--&gt;
          &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="android.intent.action.BOOT_COMPLETED"/&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
                  &lt;!-- for Gingerbread GSF backward compat --&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
                  &lt;category android:name="com.flagg327.guicomaipu" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;service
              android:name="com.flagg327.guicomaipu.gcm.RegistrationService"
              android:exported="false" /&gt;
  
          &lt;service
              android:name="com.flagg327.guicomaipu.gcm.TokenRefreshListenerService"
          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.flagg327.guicomaipu.gcm.NotificacionsListenerService"
          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;/aplication&gt;
  
      &lt;permission 
          android:name="com.flagg327.guicomaipu.C2D_MESSAGE"
              android:protectionLevel="signature" /&gt;
      &lt;uses-permission android:name="com.flagg327.guicomaipu.permission.C2D_MESSAGE" /&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
      &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&gt;
  </code></pre>
  
  <p><strong>TokenRefreshListenerService.java</strong></p>
  
  <p>The registration 'tokens' updates every day. It because that, each Android app that uses GCM must have an InstanceIDListenerService that manages those updates.</p>
  
  <pre><code>public class TokenRefreshListenerService extends InstanceIDListenerService{
  
      @Override
      public void onTokenRefresh() {
          // Launch the registration process.
          Intent i = new Intent(this, RegistrationService.class);
          startService(i);
      }
  }
  </code></pre>
  
  <p><strong>NotificacionsListenerService.java</strong></p>
  
  <p>GCM automatically shows up the push notifications, but only if the associated app has a GCMListenerService</p>
  
  <pre><code>public class NotificacionsListenerService extends GcmListenerService {
  
      @Override
      public void onMessageReceived(String from, Bundle data) {
          Log.d("A", "onMessageReceived()");
  
          // Do something
  
      }
  }
  </code></pre>
  
  <p><strong>RegistrationService.java</strong></p>
  
  <p>GCM identifies the Android devices using registration cards('tokens').My app should be able to register from each Android device on which it is installed.</p>
  
  <pre><code>public class RegistrationService extends IntentService {
  
      /**
       * Constructor
       */
      public RegistrationService() {
          super("RegistrationService");
      }
  
      @Override
      protected void onHandleIntent(Intent intent) {
          // Generate or download the registration 'token'.
          InstanceID myID = InstanceID.getInstance(this);
  
          String registrationToken = null;
          try {
              // Get the registration 'token'.
              registrationToken = myID.getToken(
                      getString(R.string.gcm_defaultSenderId),
                      GoogleCloudMessaging.INSTANCE_ID_SCOPE,
                      null
              );
  
              // Subscribe to a topic. The app is able now to receive notifications from this topic.
              GcmPubSub subscription = GcmPubSub.getInstance(this);
              subscription.subscribe(registrationToken, "/topics/guico_maipu_topic", null);
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          Log.e("Registration Token", registrationToken);
      }
  }
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <p>This error appears when I send a push notification via python.</p>
  
  <pre><code>09-13 21:21:44.800 1851-1851/? W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.flagg327.guicomaipu (has extras) }
  </code></pre>
  
  <p>Yesterday was working... Any idea? Than you for your time.</p>