我需要知道整个系统或我的应用程序是否有任何节电政策。
我发现您可以通过调用来检查省电模式是否已激活:
PowerManager oPowerManager = (PowerManager) oContext.getSystemService(Context.POWER_SERVICE);
boolean bActivated = oPowerManager.isPowerSaveMode();
但是,我如何知道我的应用程序是否在应用程序优化列表中?
最佳答案
在 PowerManager
上调用 isIgnoringBatteryOptimizations()
。引用 the documentation :
Return whether the given application package name is on the device's power whitelist. Apps can be placed on the whitelist through the settings UI invoked by ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS.
关于android - PoweSavingMode 与 App 优化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35636045/