Android Intentservice Triggered With Null Intent
I'm seeing a crash in Crashlytics: Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Intent.getIntExtra(java.lang.String,
Solution 1:
An IntentService
may be stopped like every other service, but it will be restarted by "the system" until onHandleIntent()
has finished its work. In this case, the documentation says the intent parameter
... may be null if the service is being restarted after its process has gone away
To always get the original Intent
as a parameter, use
setIntentRedelivery(true);
in the constructor of the IntentService
.
Note also that
If multiple Intents have been sent, only the most recent one is guaranteed to be redelivered.
Post a Comment for "Android Intentservice Triggered With Null Intent"