Managing Power Settings and Battery Life

Most mobile devices operate primarily using battery power. To monitor the battery, an application must have the BATTERY_STATS permission, register to receive Intent.ACTION_BATTERY_CHANGED BroadcastIntent, and implement BroadcastReceiver to extract the battery information and take any actions required. The following are some of the battery and power settings that can be monitored:

► Whether a battery exists

► The battery health, status (charging state), voltage, and temperature

► The battery charge percentage and associated icon

► Whether the device is plugged in via AC or USB power

An application can use the information about the device power state to manage its own power consumption. For example, an application that routinely uses a lot of processing power might disable features that use a lot of power in a low-power situation.

0 0

Post a comment