Restart app on force kill

耗尽温柔 提交于 2019-12-24 00:45:47

问题


I got a geolocation service. When force killed using some Task Killing apps, in the 'Manage Application' -> Running tab my App is showing as 0 Process and 1 service, and status is Restarting, but not getting restarted.

public int onStartCommand(Intent intent, int flags, int startId) {
    return START_REDELIVER_INTENT;
}

I started my service using

startService(new Intent(this, MyService.class));

Is there any way to restart the process?


回答1:


Use

return START_STICKY

instead.



来源:https://stackoverflow.com/questions/9001184/restart-app-on-force-kill

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