Doze and App Standby mode in Android 6.0

て烟熏妆下的殇ゞ 提交于 2019-12-13 16:52:12

问题


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. 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 In this link, Google says that Voip or Chat or Calling application will still work when device is in Doze mode.

  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:


  1. Yes, you can get informed of idle mode changes, by listening for DEVICE_IDLE_MODE_CHANGED intents, see: Android M listening to android.os.action.DEVICE_IDLE_MODE_CHANGED

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

  3. Same as for 1.

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



来源:https://stackoverflow.com/questions/35811042/doze-and-app-standby-mode-in-android-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!