tencent cloud

Feedback

Battery Level

Last updated: 2024-11-21 18:48:11

    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?
    
    
    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 avaliable.

    7x24 Phone Support