如何停止intentservice android系统中?系统、intentservice、android

2023-09-05 01:53:19 作者:酷也孤独

谁能告诉我如何停止 intentservice 在Android的?

Could anyone tell me how to stop intentservice in Android?

如果我用 stopservice 来停止intentservice,这是行不通的。

If I use stopservice to stop an intentservice, it doesn't work.

我浏览过的网站,但没有人给出明确的回答了这个问题。

I have browsed the website, but nobody has given a clear answer to this question.

推荐答案

尝试调用 stopSelf()从服务中。该文档说,有些过程可能需要很长的时间才能完成,所以你的服务是最有可能等待他们停止。你或许应该考虑这样做。一旦所有的请求都完成后,该服务停止本身。

Try calling stopSelf() from within the service. The documentation says that some processes may take a long time to complete, so your service is most likely waiting for them to stop. You should probably look into that. Once all requests are complete, the service stops itself.