You will want an ACTION_BATTERY_CHANGED BroadcastReceiver. See
BatteryManager for the names of the broadcast Intent extras:
EXTRA_LEVEL and EXTRA_SCALE will combine to give you a percentage.

On Tue, Jun 26, 2012 at 10:19 AM, eddieRay <[email protected]> wrote:
> What is the code to get the battery percentage of the device? I would like
> to return this as a string in my application.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to