棒棒糖isPowerSaveMode总是返回false [英] Lollipop isPowerSaveMode always returns false
本文介绍了棒棒糖isPowerSaveMode总是返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道PowerSaveMode是否已激活.我正在使用此代码:
I am trying to know if the PowerSaveMode is activated or not. I am using this code:
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
return pm.isPowerSaveMode();
但是它总是返回FALSE. 我只尝试了5.0.1的Samsung Galaxy S4,因为这是我唯一拥有的Lollipop设备. 有提示吗?
But it always returns FALSE. I have only tried with a Samsung Galaxy S4 with 5.0.1 because is the only Lollipop device I have around. Any tips?
推荐答案
我发现三星以不同的方式工作. 像往常一样,Android喜欢棘手.
I found out that Samsung works in a different way. Like always Android loves to be tricky.
bActivated = Settings.System.getString(context.getContentResolver(), "psm_switch").equals("1");
我也读到HTC必须这样:
I also read that for HTC has to be this way:
bActivated = Settings.System.getString(context.getContentResolver(), "user_powersaver_enable").equals("1");
这篇关于棒棒糖isPowerSaveMode总是返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文