This happens only on some ICS devices.
What my app is doing is basically waiting for a Broadcast and then starting a service with an intent.
The intent has a bundle attached, that will be read out with
@Override
public void onStart(Intent intent, int startId) {
sets = new SettingsClass(this);
Bundle extras = intent.getExtras();
However, on some ICS devices that leads to this stacktrace:
java.lang.RuntimeException: Unable to start service de.bulling.smstalk.Services.TTS@418218f8 with null: java.lang.NullPointerException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2375)
at android.app.ActivityThread.access$1900(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at de.bulling.smstalk.Services.TTS.onStart(TTS.java:48)
at android.app.Service.onStartCommand(Service.java:438)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2358)
... 10 more
java.lang.NullPointerException
at de.bulling.smstalk.Services.TTS.onStart(TTS.java:48)
at android.app.Service.onStartCommand(Service.java:438)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2358)
at android.app.ActivityThread.access$1900(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
The mentioned line 48 is the line where the extras are read. The same exception was issued with another service I used to call like this.
So now the question: How can I solve this problem? Is there another way of starting a service and passing it data or do I call the getExtras() in the wrong place?
Thanks!
It looks like that onStart might be deprecated, have you tried the method