Take a look at the http://developer.android.com/reference/android/content/BroadcastReceiver.html life cycle. BroadcastReceiver is created for message processing only. This means that life is very short, ant it is also stateless. Therefore, you cannot associate anything with it.
In any case, you can try to run the service form onReceive(Context context, Intent intent) the BroadcastReceiver method, for example:
public void onReceive(Context context, Intent intent) { Intent intent2 = new Intent(context, GCMService.class); intent2.putExtras(intent); context.startService(intent2); }
Then a = service should process the broadcast message.
m-szalik
source share