本文介绍了Android 6.0中的打ze和应用待机模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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).

  1. 我们(开发人员)是否可以知道以Doze模式输入的设备或以StandBy模式输入的应用程序?怎么样?
  1. Can we (developer) know, device entered in Doze mode or application entered in StandBy mode? How?


http://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases 在此链接中,Google说VoipChatCalling应用程序在设备处于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.

  1. 操作系统如何知道这是VoipchatCalling应用程序,因此我也将其保持在Doze模式下.?
  2. 当应用程序退出Doze模式时,我需要注册什么回调才能完成维护任务??
  1. How OS will come to know that this is Voip or chat or Calling app, so i will keep it awake in Doze mode too.?
  2. What callback I need to register to complete maintenance task when application is out of Doze mode.?

推荐答案

  1. 是的,您可以通过侦听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和应用待机模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:12