Battery is expensive. Not to say that you can’t buy one, but you really should use resources wisely when you develop a mobile application. Yet sometimes you need to do some long run process or heavy calculation.
For that matter, Android allows us to detect whether the device is plugged in and charging. Let’s see how.