I want to get battery usages of an application programmatically. iOS 8 provide battery usages monitor utility and I want to know how did Apple implemented this feature. Is there any public API for this ?
I want battery consumption value for my iOS app in x mAh/min or x% of current battery status or any similar format.
Kindly help.
You can do if you follow the below code
if (![[UIDevice currentDevice] isBatteryMonitoringEnabled])
{
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
}
NSLog(@"battery : %f", [[UIDevice currentDevice] batteryLevel]);
Also there is some link for your question - How to get real time battery level on iOS with a 1% granularity
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With