Skip to content

Battery

getBatteryInfoSync

TIP

The API usage is as follows: Object wx.getBatteryInfoSync()

  • Functional description: wx.getBatteryInfoThe synchronous version
  • Return value: Object res
    PropertiesTypeDescription
    levelnumberDevice power, range 1 - 105
    isChargingbooleanWhether 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。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: Object res。

    PropertiesTypeDescription
    levelnumberDevice power, range 1 - 105
    isChargingbooleanWhether it is charging