Get the battery percentage
This snippet will let you get the battery level percentage of the device.
#include <device/battery.h>
#include <dlog.h> //for logging purposes
int battery_percent = 0;
if (device_battery_get_percent(&battery_percent) == DEVICE_ERROR_NONE)
{
LOGI("Battery percentage: %d", battery_percent);
}