Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Battery Level on Phonegap

Is it possible to get the battery level on an android app using phonegap?

Thanks

like image 488
arvere Avatar asked Nov 16 '11 15:11

arvere


1 Answers

Actually it is possible to get the battery level on PhoneGap. If you want you can register event listeners for the following events:

  • "batterystatus" fired whenever the battery level changes by 1% or is plugged in or unplugged.
  • "batterylow" fired when you reach the low battery threshold i.e. 20%
  • "batterycritical" fired when you reach the critical battery threshold i.e. 5%

For some reason this hasn't shown up on the docs site. I will have to get that fixed.

like image 96
Simon MacDonald Avatar answered Sep 28 '22 18:09

Simon MacDonald