2012-03-14 31 views
0

我已经在Activity.Now中启动了一个服务,如果我强制关闭活动,那么自动服务也强制停止。是否有任何方法可以自动重新启动它。 在此先感谢。如何在android中自动重启服务?

+0

使用闹钟管理器,您可以尝试或广播接收器,您可以尝试.. – 2012-03-14 17:39:23

+0

感谢您的快速答复。如何通过广播接收器重新启动服务。 – 2012-03-14 17:41:09

+0

http://stackoverflow.com/questions/3552927/is-it-a-good-idea-to-have-a-service-just-to-register-for-intents – 2012-03-14 17:58:00

回答

0

您必须返回START_STICKYSTART_REDILIVER_INTENT实现onStartCommand()方法,但它是你的责任,通过调用stopService()stopSelf()方法停止服务。