Android 强制停止后启动服务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12672438/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Start service after force stop
提问by unflagged.destination
Is there any way to start service after user has manually stopped application using
Settings -> application -> manage application -> our app -> Force stop.
在用户使用设置 -> 应用程序 -> 管理应用程序 -> 我们的应用程序 -> 强制停止手动停止应用程序后,有什么方法可以启动服务
。
I want to restart my application after force close.
我想在强制关闭后重新启动我的应用程序。
Is there any way to do the same?
有没有办法做同样的事情?
回答by Suhail Mehta
You can't do this by starting two services because force stop will close all of your services related to the particular app which you are force stopping. So start the service when user opens the app again.
您不能通过启动两个服务来做到这一点,因为强制停止将关闭与您要强制停止的特定应用程序相关的所有服务。所以当用户再次打开应用程序时启动服务。
回答by kittu88
No, a service if Force Stopped can not be restarted automatically.
不,如果强制停止的服务无法自动重新启动。
For more assistance you can go through this article:
如需更多帮助,您可以阅读这篇文章:
http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/
http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/