BroadcastReceiver的,服务和Wakelock

编程入门 行业动态 更新时间:2024-10-10 03:30:38
本文介绍了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

本文发布于:2023-11-27 09:46:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637570.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:BroadcastReceiver   Wakelock

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!