I am using :
UIDevice *myDevice = [UIDevice currentDevice];
[myDevice setBatteryMonitoringEnabled:YES];
float batLeft = [myDevice batteryLevel];
int i = [myDevice batteryState];
int batinfo = batLeft * 100;
to find the battery status.
I am looking out to find, how to find the time remaining until the charge is complete.
ex: 1 hour 20 min remaining.
How can I find it programmatically?
I haven’t found any method for this in the official documentation, neither in the class-dumped, private header of the
UIDeviceclass.So we have to come up with something. The best “solution” I have in mind at the moment is similar to the approach taken when estimating download time: calculating an average speed of download/charging, and dividing the remaining amount (of data or charge) by that speed: