With Adobe AIR native extensions, it is extremely easy to read the battery data of your android device from within your AIR application. Here is how to get going…
1. Download the free version of our native extension – DroidBattery – from:
https://flashvisions.com/goodies/air-android-extensions/droidbattery/
2. Create a instance of DroidBattery :
var droidBattery:DroidBattery = DroidBattery.getInstance();
3. Request batterydata through public function getBatteryData()
var batteryData:BatteryData = droidBattery.getBatteryData();
trace(batteryData.rawLevel);
trace(batteryData.scale);
trace(batteryData.temperature);
trace(batteryData.voltage);
trace(batteryData.rawLevel);
trace(batteryData.scale);
trace(batteryData.temperature);
trace(batteryData.voltage);
4. Destroy the instance before closing your application
droidBattery.destroy();
Hi
I have used your Native Extension in my app
batteryData.rawLevel
batteryData.scale
batteryData.temperature unit is Celsius ?
batteryData.voltage it gives me 4138, is 4.138 volt?
Thanks
and what is rawLevel and access ?
Thanks for your great NAE
Hi,
Can i get the dynamic battery value whenever it changes on device for Android AIR application?
Regards,
Sudar