当一个服务已被杀害,如何自动重新启动?
有时甚至不要求的onDestroy()
我继承了IntentService,所以我必须要温柔。 它的工作对我来说,当我推翻onStartCommand(),但
公众诠释onStartCommand(意向意图,诠释标志,INT startId){
super.onStartCommand(意向,标志,startId);
返回START_STICKY;
}
也就是说,让家长做自己应该,然后返回START_STICKY。
When a service has been killed, how to restart it automatically?
sometimes without even calling onDestroy()
I inherited an IntentService, so I had to be gentle. It worked for me when I overrode onStartCommand() but
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
return START_STICKY;
}
That is, let the parent do what it should and return START_STICKY.