How to prevent "Scheduling restart of crashed service"?
I have a service running on the ba开发者_Python百科ckground. But sometimes I find the logcat says "Scheduling restart of crashed service". I just want to know what cause that happens? I think there is no error for my code. And also I find the service actually not restart. At least for onStart() function not works. So does anybody know what cause it and is there any way to prevent this happen? And if happens, what functions will be ran if restart?
Thanks
This might answer the part about the onStart() not running:
"Scheduling restart of crashed service", but no call to onStart() follows
As to why this happens, in my case this always happens when the app is already running but I hit the debug button in eclipse to start debugging.
This is quite understandable considering that android needs to replace the old apk with the newly built one from your machine and therefore it has to kill any existing processes running from the old apk.
精彩评论