How to programmatically detect SONY - Stamina device energy profile is ON

試著忘記壹切 提交于 2019-12-21 09:14:21

问题


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)



来源:https://stackoverflow.com/questions/18845479/how-to-programmatically-detect-sony-stamina-device-energy-profile-is-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!