To preserve the battery, applications should avoid executing code that serves no purpose. In the example above, updating the TextView's text when the user interface is not in the foreground is of little value and will only draw power from the battery unnecessarily.
In addition to the
ACTION_BATTERY_CHANGED sticky intent containing the battery information shown above, Android defines four more broadcast intents your application can use:
While you could not receive the
ACTION_BATTERY_CHANGED broadcast intent by simply declaring a receiver in your application's manifest (this receiver has to be registered explicitly with a call ...