14
score
47.3K
views
no
status
CC BY-SA 3.0
Check if device is plugged in
On Android M+ you can use the BatteryManager service via getSystemService(BATTERY_SERVICE) . On devices running pre-M you can use a sticky broadcast as mentioned by others. Example: