2

我使用 Activity 绑定到服务,然后从那里调用startService()让服务执行任务。当服务完成它调用的任务时stopSelf()。自然,在我的活动解除绑定之前,服务不会停止。在startService()Service 调用stopSelf(). 一旦 Activity 解除绑定,Service 会被销毁还是会继续运行?

4

2 回答 2

2

通过反复试验,该服务似乎继续运行。活动对 的调用startService()有效地取消了服务之前对 的调用stopSelf()。我的实验代码可以在这里找到。https://gist.github.com/Proper-Job/56d22b36714e3339be05

于 2014-08-22T07:52:23.833 回答
0

Your Service is destroyed at the point of the stopSelf()

于 2014-08-21T19:25:42.350 回答