Android : Parse throwing exception in the background

on Friday, October 31, 2014


I'm using Parse to handle push notification on my Android application. I'm also using a sticky service for playing music in the background, which doesn't get killed if my application is.


The problem is that if my application gets killed (from the task manager, for instance) when music is playing, the music keeps playing and Parse crashes in the background after a certain amount of time (or if I put my device to sleep and come back).


Here is what I get in the logs



Caused by: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.


FYI, I'm initializing Parse in the onCreate method of the Application object, and it does get called (and the push service is working correctly).


Any idea? I'm feeling that the edge case where we keep a Service running without keeping the application context is not correctly handled by the library, but I'm also hoping that there is some kind of a fix.


Thanks!


0 comments:

Post a Comment