问题描述
我做了一个应用程序,启动服务,它启动一个定时器,它的时间量后,触发了一个小功能。这是伟大的工作在仿真器和摩托罗拉Droid 1,但它不会对Droid X的工作时,手机已经进入睡眠模式。我所发现的是,计时器似乎暂停时,手机处于睡眠。它似乎并没有做到这一点对Droid的1或模拟器。我敢肯定的解决方法是不是太困难,所以我没有要求的帮助的(这一次)我只是想要一个解释,以便更好地了解这一点。
我的问题是,究竟是什么休眠模式的执行的在Android系统?是什么阻挡,什么不是停止,等等。通过睡眠模式我的意思是,当然,当你preSS电源按钮,屏幕变黑。究竟是怎么回事?任何有识之士为AP preciated。
使用 AlarmManager
是一个有点棘手。
首先,它关闭CPU。一路上,非必要的无线电(无线网络,GPS)将被关闭为好。
关于您可以在不停止计数的唯一的事情是GSM或CDMA无线(来电,短信息和IP数据包)和 AlarmManager
。
其实,这不是休眠模式,本身。也就是说,屏幕关闭
该装置将进入睡眠模式,此后不久,如果不保持它醒了 WakeLock
。但是,不能保证内的你一毫秒pressing该按钮和屏幕关闭使CPU处于关闭状态。
I have made an app that starts a service, which starts a timer, which fires off a small function after an amount of time. This is working great on the emulator and on the Motorola Droid 1, but it doesn't work on the Droid X when the phone has been put into sleep mode. What I have discovered is that the timer seems to pause when the phone is in sleep. It doesn't seem to do this on the Droid 1, or the emulator. I'm sure the workaround isn't too difficult, so I'm not asking for help(for once) I just want an explanation, to better understand this.
My question is what exactly does "sleep mode" do on android systems? What does it stop, what doesn't it stop, etc. By sleep mode I mean, of course, when you press the power button and the screen goes black. What exactly is happening? Any insight is appreciated.
Using AlarmManager
is a bit tricky.
Primarily, it shuts down the CPU. Along the way, non-essential radios (WiFi, GPS) will have been shut down as well.
About the only thing you can count on not stopping is the GSM or CDMA radio (for incoming calls, SMSes, and IP packets) and AlarmManager
.
Actually, that's not sleep mode, per se. That is the screen turning off.
The device will go into sleep mode shortly thereafter, if nothing is keeping it awake with a WakeLock
. However, there is no guarantee that within a millisecond of you pressing that button and the screen turning off that the CPU is off.
这篇关于Android的休眠/待机模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!