libgdx/libgdx — pull request #1483 by Unkn0wn0ne (2014-03-17 23:09:10+00:00)
Title: Added Application#getBatteryPercentage

- Implemented on Android + iOS
- Returns 100 on Desktop, GWT, and Headless backends because of the native code requirements which may not be available on all platforms
- Minor formatting

This adds an ability for a developer to retrieve the remaining battery level. It is designed to be called periodically, but not every frame. Probably every 10-15 minutes, longer or shorter depending on the power level. This is useful because developers can detect if a device is running low on power and alter game settings for optimal battery performance, show warnings and do other things such as save the game once it runs really low, increase save frequency, disable CPU intensive operations or limit them and more.