Search code examples
androidpower-management

Android Battery in SDK


Is there a way to get battery information from the Android SDK? Such as battery life remaining and so on? I cannot find it through the docs.


Solution

  • You can register an Intent receiver to receive the broadcast for ACTION_BATTERY_CHANGED: http://developer.android.com/reference/android/content/Intent.html#ACTION_BATTERY_CHANGED. The docs say that the broadcast is sticky, so you'll be able to grab it even after the moment the battery state change occurs.