why app service restarting, and not able to restart?

泪湿孤枕 提交于 2019-12-12 10:56:32

问题


it is a tracking app of 24*7. Whenever it stops i use START_REDELIVER_INTENT to restart it, but it is not start every time. It shows below type response in Application manager. Please suggest.


回答1:


I just discovered that if the service is killed on on 4.1.1, START_REDELIVER_INTENT can take even 20 minutes to restart the service. The restart always coincides with the next dalvikvm garbage collection. Until then the service is stuck on "Restarting" as shown in the question.

However START_STICKY restarts the service within seconds of being terminated.




回答2:


What version of Android are you trying this on?

Android 4.4.x (API 19) has some issues with background services being killed and not restarted, regardless of flags. These bugs have been widely reported but there has been no official acknowledgement of them by anyone with AOSP.

Here are links to the relevant Android issue tracker reports: #63618 and #63793.



来源:https://stackoverflow.com/questions/21845153/why-app-service-restarting-and-not-able-to-restart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!