Monitoring the Battery

Typically, all versions of the Android OS have some sort of battery-level monitoring display so that the user knows when to recharge the device. However, just because the battery level is displayed to the user doesn’t mean that the user will pay attention and plug in the phone or tablet when needed. To avoid complications from the device shutting down during app execution, you may need to monitor the battery within the app so that the app can take necessary precautions if the level gets too low. You may also require the user to have the device plugged in to external power to carry out certain operations that might require a significant power drain.

Monitoring the battery is not crucial to the MyContactList app. However, ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.