tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2025-04-10 18:18:35
Battery
Last updated: 2025-04-10 18:18:35

getBatteryInfoSync

The utilization method for this API is Object wx.getBatteryInfoSync().
Function Description: The synchronous version of wx.getBatteryInfo.
Return Value: Object res.
Attributes
Types
Note
level
number
Device battery level, ranging from 1 - 100.
isCharging
boolean
Is the device currently charging?

getBatteryInfo

The method for utilizing this API is wx.getBatteryInfo(Object object).
Function Description: This function retrieves the device's battery level. The synchronous API wx.getBatteryInfoSync is not available on iOS.
Parameters and Description: Object object.
Attributes
Types
Default value
Required
Note
success
function
-
Not required
Callback function for successful interface invocation
fail
function
-
Not required
Callback function for unsuccessful interface invocation
complete
function
-
Not required
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
object.success Callback Function Parameters: Object res.
Attributes
Types
Note
level
number
Device battery level, ranging from 1 - 100.
isCharging
boolean
Is the device currently charging?


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon