Battery
getBatteryInfoSync
TIP
The API usage is as follows: Object wx.getBatteryInfoSync()
- Functional description: wx.getBatteryInfoThe synchronous version
- Return value: Object res
Properties Type Description level number Device power, range 1 - 106 isCharging boolean Whether it is charging
getBatteryInfo
TIP
The API usage is as follows: wx.getBatteryInfo(Object object)
Functional description: Get the device power. Synchronous APIwx.getBatteryInfoSync Not available on iOS
Parameters and descriptions: Object object。
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) object.success callback function parameters: Object res。
Properties Type Description level number Device power, range 1 - 106 isCharging boolean Whether it is charging