I dont know if this can be done but right now i have a service that has an alarm manager which refreshed the battery every 5 mins to check the battery % and alert of the battery gets below a certain %. Is there a better way to watch the battery that does not require an alarm manager and refreshes when the battery changes because it seems better than refreshing after a certain amount of time
Share
tyczj,
I would create a
BroadcastReceiverto receive the following Broadcast:ACTION_BATTERY_CHANGED. This way you aren’t constantly polling the battery unnecessarily.Additional:
It would be registered like this: