Thank, Kostya. So, you mean that I should return START_STICKY_COMPATIBILITY to avoid this problem?
But the actual problem then probably lies somewhere else, which may cause the process to fail/stop in the first place. It could be some Exception. Why are they not registered? Terry On 15 Des, 11:59, Kostya Vasilyev <[email protected]> wrote: > http://developer.android.com/reference/android/app/Service.html#onSta..., > int, int) > <http://developer.android.com/reference/android/app/Service.html#onSta...> > > >> > intent The Intent supplied to|startService(Intent) > <http://developer.android.com/reference/android/content/Context.html#s...>|, > as given. *This may be null *if the service is being restarted after its > process has gone away, and it had previously returned anything > except|START_STICKY_COMPATIBILITY > <http://developer.android.com/reference/android/app/Service.html#START...>|. > > << > > I believe the above statement is not quite correct about when the intent > may be null, please see this as well: > > http://developer.android.com/reference/android/app/Service.html#START... > > You can try reproducing the issue on your development device by using > the DDMS tab in Eclipse in killing the service's process. When Android > restarts the service a bit later, check the intent. > > -- Kostya > > 15.12.2011 14:36, Terry ?????: > > > > > > > > > > > Occationally users report a NullPointerException Error at > > MyService.onStartCommand() for some of my apps. > > I never see this error when I try to debug the apps, and I wonder why > > this happens. > > I have studied the code both for the methods onStartCommand() and > > onCreate() for the services in question, but I seem unable to find the > > cause of the problem. I suspect that the actual reason for the crash > > lies elsewhere. > > > Here is the stack trace, which seems to be identical for all crashes > > on ALL of the apps in question: > > > java.lang.RuntimeException: Unable to start service > > xxxx.xxxx.xxxx.MyService@405274c8 with null: > > java.lang.NullPointerException > > at android.app.ActivityThread.handleServiceArgs(ActivityThread.java: > > 2481) > > at android.app.ActivityThread.access$2800(ActivityThread.java:145) > > at android.app.ActivityThread$H.handleMessage(ActivityThread.java: > > 1118) > > at android.os.Handler.dispatchMessage(Handler.java:99) > > at android.os.Looper.loop(Looper.java:150) > > at android.app.ActivityThread.main(ActivityThread.java:4369) > > at java.lang.reflect.Method.invokeNative(Native Method) > > at java.lang.reflect.Method.invoke(Method.java:507) > > at com.android.internal.os.ZygoteInit > > $MethodAndArgsCaller.run(ZygoteInit.java:846) > > at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604) > > at dalvik.system.NativeStart.main(Native Method) > > Caused by: java.lang.NullPointerException > > at xxxx.xxxx.xxxx.MyService.onStartCommand(MyService.java:279) > > at android.app.ActivityThread.handleServiceArgs(ActivityThread.java: > > 2464) > > > As the Google error report system does not include device type or > > Android os version, I do not know if this occurs only one some > > specific devices or os version. > > > Has anyone got an idea as to what is happening? > > > Thank you. > > Terry > > -- > Kostya Vasilyev -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

