本文主要是介绍Battery 电池信息查询与设置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 电池信息查询
adb shell dumpsys battery
Current Battery Service state:AC powered: falseUSB powered: trueWireless powered: falseMax charging current: 0Max charging voltage: 0Charge counter: 0status: 2health: 2present: truelevel: 100scale: 100voltage: 4395temperature: 320technology: Li-ion
2. 模拟电池断开充电(Android 6.0以上)
adb shell dumpsys battery unplug
3. 模拟电池为非充电状态
adb shell dumpsys battery set status 1
4. 模拟电池电量
adb shell dumpsys battery set level 100
我经常使用
adb shell dumpsys battery unplug
adb shell dumpsys battery set status 0
adb shell dumpsys battery set level 100
这篇关于Battery 电池信息查询与设置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!