检查是否为应用程序启用了电池优化 [英] Check if battery optimization is enabled or not for an app
本文介绍了检查是否为应用程序启用了电池优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Android 6和7具有一些功耗优化(打mode模式),可在不使用设备时限制应用程序联网.
Android 6 and 7 have some power optimizations (doze mode) which restrict app networking when device is not used.
用户可以在电池设置"中为任何应用禁用优化模式:
User may disable optimization mode for any app in Battery settings:
是否可以检查是否为我的应用启用了优化功能?我需要要求用户禁用优化以提高应用程序功能,但我不知道如何以编程方式进行检查.
Is it possible to check if optimization is enabled for my app or not? I need to ask user to disable optimization for better app functionality, but I don't know how to check it programatically.
推荐答案
要对此进行追踪有些棘手:这就是您要寻找的
This one was a bit tricky to track down: here's what you are looking for
PowerManager.isIgnoringBatteryOptimizations()
这篇关于检查是否为应用程序启用了电池优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文