如何停止intentservice android系统中? [英] How to stop intentservice in android?

查看:108
本文介绍了如何停止intentservice android系统中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何停止 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.

这篇关于如何停止intentservice android系统中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆