Restart app on force kill
-
19-04-2021 - |
题
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?
解决方案
Use
return START_STICKY
instead.
不隶属于 StackOverflow