如何白名单程序在打盹模式的Andr​​oid 6.0 [英] How to WhiteList app in Doze mode Android 6.0

查看:1857
本文介绍了如何白名单程序在打盹模式的Andr​​oid 6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是涉及到Android 6.0 preVIEW 3,这将是最后的在这个月的月底发布。

This question is related to the Android 6.0 Preview 3 which will be final released at the end of this month.

我是从谷歌测试一些东西,在安卓6.0在preVIEW 3的Nexus 5'锤头'。

I'm testing some stuff in Android 6.0 in the preview 3 from Google on Nexus 5 'hammerhead'.

新功能是休眠模式 - 像深度睡眠模式,当网络被禁用,手机睡觉,只有短信,来电或高优先级的GCM消息可以唤醒它。但是,像WhatsApp的 - 在休眠模式下,它接收2小时或更长时间之后,消息取决于定时器。但是,有一种不优化的应用程序被称为白名单,其中u可以手动添加应用程序列表。

The new feature is the "doze mode" - something like deep sleep mode when the network is disabled and phone sleeps, only the SMS, calls or high priority GCM messages can wake it up. But like WhatsApp - in the doze mode it receives the messages after 2 hours or more depends on the timers. But there is a list of 'not optimised' apps called "white list" where u can manually add app.

好吧,我想找到一种方法,而无需用户交互编程添加我的应用程序的白名单应用程序列表中存在的设备电池的设置。

Ok, I'd like to find a way to add my application programmatically without user interaction to the "white list app list" which exists in the device in battery settings.

尝试使用反射来获取到它,我发现:

Trying to use the reflection to get into it I found:

内android.os.IDeviceIdleController有一种方法:

Within the android.os.IDeviceIdleController there is a method:

公共抽象无效addPowerSaveWhitelistApp(字符串packageNameOfApp)

public abstract void addPowerSaveWhitelistApp (String packageNameOfApp)

但是,这是一个接口。所以,我们不能让接口的一个实例。

But this is an interface... So we can not make an instance of interface.

目前还没有文档,这个接口或有关方法,或任何继承树。

There is not yet documentation about this Interface or about methods, or any inheritance tree.

也许你有一些想法,我应该找的编程方式添加有我的应用程序的可能?

Maybe you have some idea where i should look for a possibility of programmatically add there my app?

还有一种方法

公共抽象布尔isPowerSaveWhitelistApp(字符串的packageName)

public abstract boolean isPowerSaveWhitelistApp (String packageName)

我认为应该可以访问以某种方式?检查应用程序存在于白名单,也许在最后希望要求用户将其添加到白名单中。

Which i think should be possible to access somehow?! to check if the app exist on the White List and maybe at the very end hopefully ASK user to add it to the White List.

我的问题是,有任何人你试图让事情更好的结果?因为我是被卡住,我认为它是一个死胡同。

So my question is, have anyone of you tried to make something with better result ?? cuz I'm stuck and i think its a dead end.

了解更多信息:的https: //newcircle.com/s/post/1739/2015/06/12/diving-into-android-m-doze

推荐答案

据我所知,你不能从打盹白名单自己。忽略电池的优化不会禁用打盹。在这里看到: https://开头code.google.com / P / Android的开发技术preVIEW /问题/详细信息?ID = 2225 更新:在M的发布版本,你可以要求忽略电池的优化,这将至少给你正常访问互联网,而在打盹模式

As far as I know , you cannot whitelist yourself from Doze. Ignore battery optimizations does not disable doze. See here: https://code.google.com/p/android-developer-preview/issues/detail?id=2225 UPDATE: In the release build of M , you can request ignore battery optimizations which will at least give you normal access to the internet while in Doze mode.

这篇关于如何白名单程序在打盹模式的Andr​​oid 6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆