I have a problem with Android service restart. I am building against API version 7 and running on a device with Android 2.3.3.
The problem is, that when my service is killed by the system and is later restarted, only the onCreate()
of my service is called. code in onStartCommand()
is not executed. If I start my application for the first time, the code in onStartCommand()
is normally executed and all works fine, until system kills my service, then the service will not restart correctly.
Documentation says that onStartCommand()
is always called when a service is restarted. In the case of service restart, the onStartCommand()
should be called with null intent. This is not my case.
Any idea why this could happen?
You might be seeing a bug in Gingerbread. There was a thread in the android-developers group about it: onStartCommand bug thread
See the post numbered 26 by Dianne Hackborn for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With