android – 如何从Doze模式中选择退出应用程序?

如何从android M DOZE模式中选择退出我的应用程序?
是否有标准方法在运行时有选择地包含和排除DOZE和自动待机中的应用程序?

最佳答案

How to opt-out my app from android M DOZE mode ?

你不能通过任何已知的机制.

Is there a standard way to include and exclude apps from DOZE and auto standby selectively at run time ?

理论上,用户可以在“设置”中切换“忽略优化”选项,将应用程序放在不应进入应用程序待机模式的应用程序白名单中.这不会影响打盹模式.

引用somebody who I believe is Dianne Hackborn

While the device is dozing,syncs and jobs are turned off globally,putting an app on the whitelist does not change the behavior for them. This is the intended behavior,as is the lack of free use of the alarm manager. (One of the key aspects of all of these is that they are ways to cause the device to wake up,and anything that causes it to wake up will have a significant impact on battery life in the durations we want to last while dozing,so it is simply not allowed.)

While dozing,the AndAllowWhileIdle APIs allow you to wake up the device at most once every 15 minutes; when not dozing this is raise to once every minute. When the device is in idle maintenance mode,all of the doze restrictions are removed (so AllowWhileIdle can happen once a minute).

注意,“空闲维护模式”目前没有记录.我的猜测是,这是指一个闲置但正在充电的设备.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...