I want to notify user that my app will not work properly if he has SONY android phone with STAMINE energy profile ON. This profile is blocking AlarmManager and device is not waked up when I want.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Currently, there is no official way to detect if the STAMINA energy profile is selected. However, if there is enough community demand we may be able to open this up.
回答2:
You could check it via
Settings.Secure.getInt(contentResolver, "somc.stamina_mode", 0) == 1
Works at least on the Sony Xperia XZ1 Compact (8.0.0)