I am getting this error after closing (and removing from recent app on my device) my app, it occurs everytime.
09-22 23:44:28.503 4021-4021/? I/art﹕ Late-enabling -Xcheck:jni
09-22 23:44:28.584 4021-4021/cz.united121.android.revizori D/cz.united121.android.revizori.App﹕ onCreate
09-22 23:44:28.642 4021-4021/cz.united121.android.revizori D/cz.united121.android.revizori.service.MyUpdatingService﹕ onCreate
09-22 23:44:28.677 4021-4021/cz.united121.android.revizori D/AndroidRuntime﹕ Shutting down VM
09-22 23:44:28.679 4021-4021/cz.united121.android.revizori E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: cz.united121.android.revizori, PID: 4021
java.lang.RuntimeException: Unable to start service cz.united121.android.revizori.service.MyUpdatingService@3a7bf84e with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2913)
at android.app.ActivityThread.access$2100(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
at cz.united121.android.revizori.service.MyUpdatingService.onStartCommand(MyUpdatingService.java:94)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2896)
at android.app.ActivityThread.access$2100(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
The line (Log.d(TAG, "onStartCommand" + intent.getAction());) which is exception refer is in Service in onStartCommand:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Log.d(TAG, "onStartCommand" + intent.getAction());
if (intent.getAction().equals(SERVICE_FORCE)) {
LOCATION_APROVAL = true;
if (mLastKnownPosition != null) {
mTimeAproving.run();
}
} else if (intent.getAction().equals(SERVICE_START)) {
mUpdatingTimer.scheduleAtFixedRate(mTimeAproving, 0, PERIOD_BETWEEN_UPDATING);
} else if (intent.getAction().equals(SERVICE_STOP)) {
LOCATION_APROVAL = false;
mLastKnownPosition = null;
mUpdatingTimer.cancel();
mUpdatingTimer.purge();
}
return START_STICKY;
}
Thank you in advance.