0

在 android 应用程序中,如果我保存正在运行的服务的意图。如何重新启动服务?我希望它再次运行 onStartCommand 函数。

谢谢

4

1 回答 1

1

onStartCommand回报START_STICKY

public int onStartCommand(Intent intent, int flags, int startId){
   super.onStartCommand(intent, flags, startId);
   return  START_STICKY; 
}

文档链接:http: //developer.android.com/reference/android/app/Service.html

于 2014-09-25T14:39:30.330 回答