I'm not sure whats wrong in it! I read here that Intentservice is itself a subclass of Context
.
public class GCMNotificationIntentService extends IntentService {
private NotificationManager mNotificationManager;
NotificationCompat.Builder builder;
Context mainContext;
WriteFile writeFile;
public GCMNotificationIntentService() {
super("GcmIntentService");
mainContext = getApplicationContext();
writeFile = new WriteFile(mainContext);
}
// My rest of the code
}
but I'm getting null value for mainContext
.
Any suggestions are most welcome.