It’s always good that an app has different behavior when device is connected/disconnected to a power station, or has different battery levels.

One can monitor the changes in charging state with a broadcast receiver registered on the actions ACTION_POWER_CONNECTED and ACTION_POWER_DISCONNECTED, or monitor significant changes in battery level with a broadcast receiver registered on the actions BATTERY_LOW and BATTERY_OKAY.

Compliant Code Example

new IntentFilter(Intent.ACTION_POWER_CONNECTED)

Or

new IntentFilter(Intent.ACTION_POWER_DISCONNECTED)

Or

new IntentFilter(Intent.ACTION_POWER_BATTERY_OKAY)

Or

new IntentFilter(Intent.ACTION_POWER_BATTERY_LOW)