当获取激活锁定为目的服务? [英] When to acquire wakelock for an intent service?

查看:227
本文介绍了当获取激活锁定为目的服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解的Andr​​oid使用部分唤醒锁。我有启动另一个意图服务清醒的意图服务。

I am trying to understand the use of partial wake locks in android. I have a wakeful intent service which starts another intent service.

如果我没有获得被叫意图服务激活锁定时,意图将当CPU唤醒处理?是否存在这样这些意图并非在所有处理的任何场景?

If I don't acquire a wakelock for the called intent service, the intents will be processed when the CPU wakes up? Is there any scenario where these intents are not processed at all?

推荐答案

如果你调用startService()[直接或通过在服务的PendingIntent调用send()],它启动旋转了该服务的操作系统的过程。要在中间睡觉不会中断该进程的装置;它只是推迟,直到该设备是清醒和运行足够长的时间来完成启动,您所请求的服务的过程。

If you call startService() [whether directly or by calling send() on a service PendingIntent], it starts up the OS's process of spinning up that service. The device going to sleep in the middle won't interrupt that process; it will just delay it until the device is awake and running long enough to finish the process of starting up the service you requested.

唯一一次该服务将的从不的开端是,如果有什么不对的startService()请求本身 - 的意图没有解决一个真正的服务定义,或者你没有权限启动该服务,或者类似的东西。这些失效模式都没有什么关系wakelocks,虽然。该激活锁定的情况不会造成startService(),以彻底失败。

The only time the service will never start is if there is something wrong with the startService() request itself -- the Intent does not resolve to a real Service definition, or you don't have permission to start that service, or something like that. None of these failure modes have anything to do with wakelocks, though. The wakelock situation won't cause startService() to fail outright.

这篇关于当获取激活锁定为目的服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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