I'm using this function to get current battery level of device:
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
UIDevice *myDevice = [UIDevice currentDevice];
[myDevice setBatteryMonitoringEnabled:YES];
double batLeft = (float)[myDevice batteryLevel];
NSLog(@"%f",batLeft);
but the result has a 5% granularity. Example: when the phone battery is at 88%, it only logs a value of 0.85. batteryLevel
only returns values in increments of 0.05. For example: 0.85, 0.9, 0.95 and never returns values like 0.82 or 0.83.
Is there any solution to get a percentage with a higher precision?
There are at least four different ways to read the battery level, and all four ways may return different values.
Here is a chart of these values through time.
The values were recorded with this iOS project: https://github.com/nst/BatteryChart
Please check out the code for reference.