You are here: Battery API
The Battery API provides a standard interface that can be used across multiple hardware platforms for checking the current state of a device's battery. It enables your app to register/ unregister for the battery monitoring service of the device operating system and check the battery level on the customer's device.
The Battery API uses
voltmx.os Namespace and the following API elements.
|Retrieves the current percentage charge level of the device battery, as an integer value.
|Retrieves the current state of the battery.
|Registers for the battery monitoring service of the device operating system.
|Stops the monitoring process of the device battery.
To register for the battery monitoring service of the device operating system, invoke the voltmx.os.registerBatteryService function. The callback is delivered to the most recent registered battery service. If you want to stop the monitoring process of the device battery, use the voltmx.os.unregisterBatteryService function. You must call this API when the use of the battery monitoring service has been completed, to reduce the overhead.
To view the functionality of the Battery API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Volt MX App.