title: BroadcastReceiver doesn't get called when using it for push notification
body: <p>I am trying to use GCM push notification of Android in a plugin. I am getting the valid registration ID from Google server. But when I send any data from server, the <code>BroadcastReceiver</code> doesn't get called at all. I think the issue is with the permissions in manifest, here's the portion of manifest that I am using - </p>
  
  <pre><code>&lt;receiver
  android:name="com.creator.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;category android:name="com.creator.test" /&gt;
  &lt;/intent-filter&gt;
  &lt;!-- Receive the registration id --&gt;
  &lt;intent-filter&gt;
  &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
  &lt;category android:name="com.creator.test" /&gt;
  &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  &lt;service android:name="com.creator.gcm.GcmIntentService" /&gt;
  
  &lt;uses-permission android:name="android.permission.WAKE_LOCK"/&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE"/&gt;
  
  
  &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS"/&gt;
  
  &lt;permission android:name="com.creator.test.permission.C2D_MESSAGE"
  android:protectionLevel="signature" /&gt;
  &lt;uses-permission android:name="com.creator.test.permission.C2D_MESSAGE" /&gt;
  </code></pre>
  
  <p>My code for boradcast receiver is taken from the official Android example, still here's the code - </p>
  
  <pre><code>public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
      private static final String TAG = "BROADCAST_TAG";
      @Override
      public void onReceive(Context context, Intent intent) {
          Log.d(TAG, "onReceive");
          // 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>The IntentService - </p>
  
  <pre><code>public class GcmIntentService extends IntentService {
  
      private static native void native_notificationCallback();
  
      public static final int NOTIFICATION_ID = 1;
      private NotificationManager mNotificationManager;
      NotificationCompat.Builder builder;
      private static final String TAG = "INTENT_TAG";
  
      public GcmIntentService() {
          super("GcmIntentService");
          Log.d(TAG, "GcmIntentService");
      }
  
      @Override
      protected void onHandleIntent(Intent intent) {
          Log.d(TAG, "onHandleIntent");
          Bundle extras = intent.getExtras();
          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(5000);
                      } catch (InterruptedException e) {
                      }
                  }
                  Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
                  sendNotification("Received: " + extras.toString());
                  Log.i(TAG, "Received: " + extras.toString());
              }
          }
          GcmBroadcastReceiver.completeWakefulIntent(intent);
      }
      private void sendNotification(String msg) {
          Log.d(TAG, "Got Notification: "+msg);
          mNotificationManager = (NotificationManager)
                  this.getSystemService(Context.NOTIFICATION_SERVICE);
  
          PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                  new Intent(this, LoaderActivity.class), 0);
  
          NotificationCompat.Builder mBuilder =
                  new NotificationCompat.Builder(this)
          //.setSmallIcon(R.drawable.ic_launcher)
          .setContentTitle("GCM Notification")
          .setStyle(new NotificationCompat.BigTextStyle()
          .bigText(msg))
          .setContentText(msg);
  
          mBuilder.setContentIntent(contentIntent);
          mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
      }
  }
  </code></pre>
  
  <p>On Installation the device always generates this msg at logcat - </p>
  
  <pre><code>10-13 21:31:59.329: W/ActivityManager(2190): No content provider found for permission revoke: file:///data/local/tmp/Notification Example.apk
  10-13 21:31:59.489: W/ActivityManager(2190): No content provider found for permission revoke: file:///data/local/tmp/Notification Example.apk
  10-13 21:32:00.129: I/PackageManager(2190): Running dexopt on: com.creator.test
  10-13 21:32:01.371: I/ActivityManager(2190): Force stopping package com.creator.test uid=10180
  10-13 21:32:01.531: D/PackageManager(2190): New package installed in /data/app/com.creator.test-1.apk
  10-13 21:32:01.531: W/PackageManager(2190): Unknown permission android.permission.ADD_SYSTEM_SERVICE in package com.android.phone
  10-13 21:32:01.531: W/PackageManager(2190): Unknown permission com.google.android.providers.gmail.permission.READ_GMAIL in package com.mobisystems.fileman
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission android.permission.RECEIVE_USER_PRESENT in package com.stericsson.atservice
  10-13 21:32:01.541: W/PackageManager(2190): Not granting permission android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS to package com.android.browser (protectionLevel=2 flags=0x9be45)
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.android.permission.FACERECOGNITION_SERVICE in package com.sonyericsson.android.camera3d
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.android.launcher.permission.READ_SETTINGS in package com.android.settings
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.android.launcher.permission.WRITE_SETTINGS in package com.android.settings
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.android.permission.FACERECOGNITION_SERVICE in package com.sonyericsson.android.camera
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.google.android.voicesearch.SHORTCUTS_ACCESS in package com.google.android.googlequicksearchbox
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.google.android.ears.permission.WRITE in package com.google.android.googlequicksearchbox
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.google.android.apps.googlevoice.permission.AUTO_SEND in package com.google.android.googlequicksearchbox
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.android.chrome.PRERENDER_URL in package com.google.android.googlequicksearchbox
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.facebook.orca.provider.ACCESS in package com.facebook.katana
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission android.permission.ACCESS_LOCATION in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission android.permission.ACCESS_GPS in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission android.permission.ACCESS_WAKE_LOCK in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.servicemenu.permission.ACCESS_SERVICE_MENU in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sony.nfx.app.irremoteservice.permission.EXECUTE_SERVICE in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission android.permission.FM_RADIO_RECEIVER in package com.sonyericsson.android.servicemenu
  10-13 21:32:01.541: W/PackageManager(2190): Not granting permission com.sonyericsson.permission.INSTALL_APPLICATION to package com.sonyericsson.trackid (protectionLevel=2 flags=0x8be44)
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.USERAGENT in package com.sonyericsson.trackid
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CUSTOMIZATION in package com.sonyericsson.trackid
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonymobile.permission.SOMC_CAMERA in package com.sonymobile.cameraautoupload
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.BLACKLISTED_USB_DEVICE in package com.sonyericsson.extras.liveware
  10-13 21:32:01.541: W/PackageManager(2190): Unknown permission com.sonyericsson.music.permission.MUSICSERVICE in package com.sonyericsson.extras.liveware
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.VENDOR_BUTTON in package com.sonyericsson.extras.liveware
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.READ_LOGS to package com.stackexchange.marvin (protectionLevel=50 flags=0x8be44)
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.android.launcher.permission.READ_SETTINGS in package com.google.android.onetimeinitializer
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.android.launcher.permission.WRITE_SETTINGS in package com.google.android.onetimeinitializer
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sonymobile.permission.READ_CONTACT_FACE_META in package com.sonymobile.photoanalyzer
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sonymobile.permission.WRITE_CONTACT_FACE_META in package com.sonymobile.photoanalyzer
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.READ_LOGS to package com.avast.android.mobilesecurity (protectionLevel=50 flags=0x28be44)
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.MODIFY_PHONE_STATE to package com.avast.android.mobilesecurity (protectionLevel=18 flags=0x28be44)
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.DUMP to package com.avast.android.mobilesecurity (protectionLevel=50 flags=0x28be44)
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission android.permission.ACCESS_SUPERUSER in package com.avast.android.mobilesecurity
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sony.walkman.media.service.permission.ACCESS_TEMPORARY_PROVIDER in package com.sonyericsson.video
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sony.walkman.media.service.permission.ACCESS_DRM in package com.sonyericsson.video
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.FMRADIO in package com.sonyericsson.dlna
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.google.android.gallery3d.permission.PICASA_STORE in package com.google.android.apps.plus
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission com.google.android.hangouts.START_HANGOUT in package com.google.android.apps.plus
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS to package com.android.vending (protectionLevel=2 flags=0xabec5)
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission android.permission.MANAGE_USERS in package com.android.vending
  10-13 21:32:01.551: W/PackageManager(2190): Unknown permission android.permission.INTERACT_ACROSS_USERS in package com.android.vending
  10-13 21:32:01.551: W/PackageManager(2190): Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.android.vending (protectionLevel=50 flags=0xabec5)
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CRASHSMS in package com.sonyericsson.crashmonitor
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonymobile.dlna.permission.READ_DATA in package com.sonyericsson.album
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.extras.liveview.permission.LIVEVIEW_API in package com.sonyericsson.androidapp.timescapefeedsplugin
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CUSTOMIZATION in package com.sonyericsson.androidapp.retaildemo
  10-13 21:32:01.561: W/PackageManager(2190): Not granting permission android.permission.CLEAR_APP_USER_DATA to package com.sonyericsson.androidapp.retaildemo (protectionLevel=2 flags=0xbe45)
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sony.walkman.database.media.permission.WRITE_MEDIA_METADATA in package com.sonyericsson.metadatacleanup
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sony.walkman.database.media.permission.ACCESS_DRM_METADATA in package com.sonyericsson.metadatacleanup
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sony.walkman.permission.ACCESS_MEDIA in package com.sonyericsson.metadatacleanup
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.timhoeck.android.eventghost.permission.SEND_EVENTS in package de.gavitec.semc
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CUSTOMIZATION in package com.sonyericsson.textinput.chinese
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.android.vending.billing.IBillingAccountService.BIND2 in package com.google.android.gsf.login
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CONTACTS_PICK_CONVERSATIONS_TARGET in package com.sonyericsson.conversations
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.pws.permission.EMERGENCY_ALERTS in package com.sonyericsson.conversations
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.ACCESS_PROTECTED_CONTACTS in package com.sonyericsson.conversations
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CUSTOMIZATION in package com.sonyericsson.textinput.uxp
  10-13 21:32:01.561: W/PackageManager(2190): Unknown permission android.permission.INTERACT_ACROSS_USERS in package com.google.android.gms
  10-13 21:32:01.571: W/PackageManager(2190): Unknown permission android.permission.LOCATION_HARDWARE in package com.google.android.gms
  10-13 21:32:01.571: W/PackageManager(2190): Unknown permission android.permission.GET_APP_OPS_STATS in package com.google.android.gms
  10-13 21:32:01.571: W/PackageManager(2190): Unknown permission android.permission.UPDATE_APP_OPS_STATS in package com.google.android.gms
  10-13 21:32:01.671: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.FMRADIO in package com.sonyericsson.music
  10-13 21:32:01.671: W/PackageManager(2190): Not granting permission com.google.android.gm.permission.READ_GMAIL to package com.sonyericsson.music (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.671: W/PackageManager(2190): Unknown permission com.sony.walkman.database.media.permission.WRITE_MEDIA_METADATA in package com.sonyericsson.music
  10-13 21:32:01.671: W/PackageManager(2190): Unknown permission com.sony.walkman.database.media.permission.ACCESS_DRM_METADATA in package com.sonyericsson.music
  10-13 21:32:01.671: W/PackageManager(2190): Unknown permission com.sony.walkman.media.service.permission.ACCESS_TEMPORARY_PROVIDER in package com.sonyericsson.music
  10-13 21:32:01.671: W/PackageManager(2190): Unknown permission com.sonymobile.dlna.permission.READ_DATA in package com.sonyericsson.music
  10-13 21:32:01.671: W/PackageManager(2190): Not granting permission android.permission.BIND_DEVICE_ADMIN to package com.android.email (protectionLevel=2 flags=0xbbc45)
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CUSTOMIZATION in package com.sonyericsson.android.pobox
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.android.launcher.permission.PRELOAD_WORKSPACE in package com.google.android.partnersetup
  10-13 21:32:01.681: W/PackageManager(2190): Not granting permission android.permission.DEVICE_POWER to package com.sonyericsson.android.socialphonebook (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.681: W/PackageManager(2190): Not granting permission android.permission.ACCESS_DRM to package com.sonyericsson.android.socialphonebook (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.sonyericsson.phone.CALL_SCREEN_SHORTCUT in package com.sonyericsson.android.socialphonebook
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.android.email.permission.ACCESS_GAL_PROVIDER in package com.sonyericsson.android.socialphonebook
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.sonyericsson.aab.READ_ICE_CONTACTS in package com.sonyericsson.android.socialphonebook
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CONTACTS_PICK_CONVERSATIONS_TARGET in package com.sonyericsson.android.socialphonebook
  10-13 21:32:01.681: W/PackageManager(2190): Not granting permission com.sonyericsson.permission.IDD to package com.sonyericsson.android.socialphonebook (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.681: W/PackageManager(2190): Unknown permission com.google.android.providers.gmail.permission.READ_GMAIL in package com.mobisystems.office
  10-13 21:32:01.681: W/PackageManager(2190): Not granting permission android.permission.WRITE_MEDIA_STORAGE to package com.mobisystems.office (protectionLevel=18 flags=0x1cbe44)
  10-13 21:32:01.681: W/PackageManager(2190): Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.whatsapp (protectionLevel=50 flags=0xbe44)
  10-13 21:32:01.691: W/PackageManager(2190): Not granting permission android.permission.BROADCAST_SMS to package com.sonyericsson.nfc (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.CONTACTS_PICK_CONVERSATIONS_TARGET in package com.sonyericsson.nfc
  10-13 21:32:01.691: W/PackageManager(2190): Not granting permission android.permission.ACCESS_BLUETOOTH_SHARE to package com.sonyericsson.nfc (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission com.sonyericsson.permission.ACCESS_PROTECTED_CONTACTS in package com.sonyericsson.nfc
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission android.provider.Telephony.SMS_RECEIVED in package com.sonyericsson.nfc
  10-13 21:32:01.691: W/PackageManager(2190): Not granting permission com.google.android.gm.permission.READ_GMAIL to package com.sonyericsson.nfc (protectionLevel=2 flags=0x8be45)
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission com.vodafone.vodafone360updates.permission.SHOW_SETUP_WIZARD in package com.sonyericsson.setupwizard
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission com.sonyericsson.timescape.permission.TIMESCAPE_SETTINGS in package com.sonyericsson.settings
  10-13 21:32:01.691: W/PackageManager(2190): Unknown permission com.sonyericsson.eventstream.twitterplugin.AUTHENTICATION in package com.sonyericsson.eventstream.twitterpostviewer
  10-13 21:32:01.701: W/PackageManager(2190): Not granting permission android.permission.DEVICE_POWER to package com.sonyericsson.organizer (protectionLevel=2 flags=0x8bc45)
  10-13 21:32:01.701: W/PackageManager(2190): Unknown permission com.sony.walkman.database.media.permission.ACCESS_DRM_METADATA in package com.sonyericsson.musicvisualizer
  10-13 21:32:01.701: W/PackageManager(2190): Unknown permission andriod.permission.MANAGE_USB in package com.sonyericsson.usbux
  </code></pre>
  
  <p>I don't even use most of these permissions. I am using a Sony Xperia P to debug, if that matters.
  When I call register my device with GCM server, this the output I get in the logcat - </p>
  
  <pre><code>10-13 21:33:21.509: W/GCM(2527): DIR: /data/data/com.google.android.gms/app_APP /data/data/com.google.android.gsf
  10-13 21:33:21.959: D/BROADCAST_TAG(5204): onReceive
  10-13 21:33:21.969: D/INTENT_TAG(5204): GcmIntentService
  10-13 21:33:21.979: D/INTENT_TAG(5204): onHandleIntent
  10-13 21:35:36.611: I/Icing.InternalIcingCorporaProvider(3573): Updating corpora: A: MAYBE, C: FORCE_ALL
  10-13 21:35:38.653: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.653: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.693: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.693: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.703: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.703: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.723: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.723: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.753: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  10-13 21:35:38.753: W/ActivityManager(2190): Permission denied: checkComponentPermission() owningUid=10089
  </code></pre>
  
  <p>So according to output, I guess this is some kind of permission issue. The sender ID and browser key that I am using is correct, and I have verified it many times already.<br>
  One interesting thing to note here is, the broadcastIntent gets called when I register the device with GCM, dunno why, and then doesn't get called at all.     </p>
  
  <p>I've checked many answers on SO itself, but none of them helped me to resolve this issue.
  I'd appreciate any help to solve this problem, I have been trying to solve it for last 2 weeks. </p>
  
  <p>PS: let me know if more info are required to understand the problem.</p>
  
  <p><strong>UPDATE:-</strong>
  When the first time BroadcastReceiver gets called, it returns the registration id. The <code>extras.toString()</code> methood returned this - </p>
  
  <pre><code>Bundle[{registration_id=****my_device_reg_id**, android.support.content.wakelockid=1}]
  </code></pre>