问题描述
Google在Android 6.0 OS上引入了Doze和App Standby模式.
如果拔出设备并在一段时间内不使用设备,并且应用程序在一段时间内保持不活动状态,则该设备将进入StandBy
模式(如果我输入错了,请纠正我).
Google introduced Doze and App Standby mode with Android 6.0 OS.
Device will enter in Doze
mode if device is unplugged and unused for some amount of time and if application stays inactive for some amount of time, that app goes in StandBy
mode (Correct me if I am wrong).
- 我们(开发人员)是否可以知道以
Doze
模式输入的设备或以StandBy
模式输入的应用程序?怎么样?
- Can we (developer) know, device entered in
Doze
mode or application entered inStandBy
mode? How?
http://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases 在此链接中,Google说Voip
或Chat
或Calling
应用程序在设备处于Doze
模式.
http://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases In this link, Google says that Voip
or Chat
or Calling
application will still work when device is in Doze
mode.
- 操作系统如何知道这是
Voip
或chat
或Calling
应用程序,因此我也将其保持在Doze
模式下.?
- 当应用程序退出
Doze
模式时,我需要注册什么回调才能完成维护任务??
- How OS will come to know that this is
Voip
orchat
orCalling
app, so i will keep it awake inDoze
mode too.? - What callback I need to register to complete maintenance task when application is out of
Doze
mode.?
推荐答案
-
是的,您可以通过侦听DEVICE_IDLE_MODE_CHANGED意图来了解空闲模式的更改,请参阅:
您需要将您的应用列入白名单,详细信息在这里: https://developer.android.com/training/monitoring-device-state/doze-standby.html#support_for_other_use_cases
You will need to whitelist your app, details here: https://developer.android.com/training/monitoring-device-state/doze-standby.html#support_for_other_use_cases
与1相同.
此页面对于打ze模式以及如何测试应用程序对空闲状态的处理也是非常有用的说明: https://newcircle.com/s/post/1739/2015/06/12/diving-into-android-m-doze
This page is also a really useful explanation of doze mode and how to test your app's handling of idle state: https://newcircle.com/s/post/1739/2015/06/12/diving-into-android-m-doze
这篇关于Android 6.0中的打ze和应用待机模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!