安卓:可能code当设备进入睡眠状态,并从睡眠中唤醒启动服务 [英] Android: possible code to start a service when device goes to sleep and wakes from sleep

查看:165
本文介绍了安卓:可能code当设备进入睡眠状态,并从睡眠中唤醒启动服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要当设备进入,当它醒来睡觉,也是我的服务自动启动。我该怎么做就无需在后台持续运行的服务,检查设备的状态?

I want my service to start automatically when the device goes to sleep and also when it wakes up. How do i do it without making the service run continuously in background to check the state of device?

例如,我可以我的服务添加到上手起来的系统默认的服务列表中,当设备被唤醒?如果是的话,该怎么办呢?

For example, can i add my service to the list of system default services that get started up when a device wakes up?if so, how to do it?

推荐答案

如果你正在谈论的电话事件,则广播接收机是解决方案

If you are talking about phone events then broadcast receivers is the solution

这篇关于安卓:可能code当设备进入睡眠状态,并从睡眠中唤醒启动服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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