How to get real time battery level on iOS with a 1% granularity

后端 未结 7 1730
清酒与你
清酒与你 2020-12-05 03:19

I\'m using this function to get current battery level of device:

[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
UIDevice *myDevice = [UIDevice c         


        
7条回答
  •  死守一世寂寞
    2020-12-05 04:06

    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.

    iPhone 5 Battery

提交回复
热议问题