android - PoweSavingMode 与 App 优化

标签 android battery-saver

我需要知道整个系统或我的应用程序是否有任何节电政策。

我发现您可以通过调用来检查省电模式是否已激活:

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/

相关文章:

android - AndEngine - 在主分支中找不到 AndEngineMultiplayerExtension

java - Android 蓝牙 LE 禁用通知回调耗尽电池?

android - 以编程方式启用/禁用 "Battery Saver"模式

Android 服务仅在 UI 处于 Activity 状态时运行

java - SearchBar、RecyclerView 和 CardView 的问题

android - 如何为 Gingerbread 应用程序应用果冻 bean 应用程序主题?

android - EditText.setError 不显示错误文本,只显示图标

android - android动画中的平滑文本变化