@ohos.batteryInfo (电量信息)API 11 Release:https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...API 12 Canary1:https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...
在HarmonyOS NEXT中,你可以通过@ohos.batteryInfo模块获取设备是否在充电和电池电量百分比。可以使用batterySOC属性来获取电池电量百分比,chargingStatus属性可以帮助你判断设备是否正在充电。
@ohos.batteryInfo (电量信息)API 11 Release:
https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...
API 12 Canary1:
https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...