I have a self implemented Application class.
I’m trying to get a reference to it from my application GCMIntentService.
From Some reason it returns null:
public class GCMIntentService extends GCMBaseIntentService {
private AppVariables app;
private GCMMessageReceiver gcmMessageReceiver;
public GCMIntentService()
{
super(GCMManager.SENDER_ID);
this.app = (AppVariables) getApplication();
this.gcmMessageReceiver = new GCMMessageReceiver(app);
}
}
You can do this from
onRegistered()method.Because we can’t change constructor
GCMIntentService()to pass context there to use.