BroadcastReceiver的,服务和Wakelock [英] BroadcastReceiver, Service and Wakelock

查看:160
本文介绍了BroadcastReceiver的,服务和Wakelock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时接收广播接收机的意图,然后我开始服务做更多的工作。现在如果该设备是睡觉,这一点,我一定要得到Wakelock(AlarmManger?),为什么我需要它? 请问我的服务将停止运行,如果该设备不用得到一个wakelock睡觉。

解决方案
  

现在,如果该设备是睡眠,这种情况发生,我一定要得到Wakelock(AlarmManger?),为什么我需要它?

如果该设备是睡着了,首先,你会不会接收广播接收机的意图,因为该设备是睡着了。

  

我一定要得到Wakelock(AlarmManger?),为什么我需要它?

您不需要,除非你想确保当你完成一些工作,保持运行的装置。

  

做我的服务将停止运行,如果该设备不用得到一个wakelock睡觉。

是的。

im receiving an intent in broadcast receiver and then i start service to do more work. now what if the device is sleep and this happen, do i have to get Wakelock (AlarmManger?), and why do i need it? does my service will stop running if the device goes to sleep without getting a wakelock.

解决方案

now what if the device is sleep and this happen, do i have to get Wakelock (AlarmManger?), and why do i need it?

If the device is asleep to begin with, you will not be "receiving an intent in broadcast receiver", because the device is asleep.

do i have to get Wakelock (AlarmManger?), and why do i need it?

You don't "need it", unless you want to ensure the device stays running while you complete some work.

does my service will stop running if the device goes to sleep without getting a wakelock.

Yes.

这篇关于BroadcastReceiver的,服务和Wakelock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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