永葆意图服务应用程序被杀害后, [英] Keeping alive Intent Service after application is killed

查看:236
本文介绍了永葆意图服务应用程序被杀害后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序的意图服务。该服务有一些工作要做 - 上传一些文件。它运行时,才会有事情做。

I have intent service in my app. This service has some job to do - uploading some files. It runs only when there is something to do.

在某些条件得到满足,例如没有互联网连接服务将无法上传。出于这个原因,它本身注册在广播接收器接收有关互联网连接的变化信息。

Service won't upload when some conditions are met, for example no Internet connection. For that reason it registers itself to on broadcast receiver to receive message about Internet connection changes.

问题在于服务被杀害与应用程序,即使它是做什么的,例如:

The problem is that service is killed with app even if it is doing something, for example:


  1. 应用发送意图服务

  2. 服务开始上传一些东西,样样精

  3. X%上传,应用程序被杀害,服务被杀害

  4. Internet连接改变 - 服务被唤醒

如果服务应用程序被杀害后唤醒,为什么它的应用程序杀死?有没有什么办法prevent当应用程序被杀死杀伤的服务?

If service is woken up after app is killed, why is it killed with the app? Is there any way to prevent killing service when app is killed?

我手动查杀应用程序。我知道Android的能杀我的服务随时随地我不想prevent它。我只是想有这个服务运行的用户关闭或死亡的应用后。

I'm killing app manually. I know android could kill my service anytime and I don't want to prevent it. I just want to have this service running after user closed or killed app.

推荐答案

它运行时,才会有事情做。只有理论上:) - 也许这就是你要达到什么

"It runs only when there is something to do." only theoretically :) - maybe that is you what you want to achieve.

问题是该服务被杀害与应用程序,即使它是做什么的,例如:
当然,也会有当用户操作将结束您的服务或意向服务案例。
是一个失败的答案。

"The problem is that service is killed with app even if it is doing something, for example:" Of course, there will be cases when the user action will end your Service or Intent service. This is a fail answer.

这有什么办法prevent当应用程序被杀死杀伤的服务?
它只是看在谷歌家长控制任务保护关键字!

"Is there any way to prevent killing service when app is killed?" It is just watch for "parental control" task protection" keywords in Google!

这篇关于永葆意图服务应用程序被杀害后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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