iosbatteryuidevice

How to obtain extensive battery info in iOS?


I'm wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS?

I know UIDevice class, but battery level is not what I'm looking for.


Solution

  • I might be wrong about this but using public APIs this is not possible. According to the UIDevice documentation, it appears the most you can do is get the battery charge level, its state, and enable battery monitoring.

    Update 15th Feb 2019: Looks like iOS UIDevice API's now allow developers to get access to battery charge level for the device. Whooo! It currently exposes 4 different API's. By the looks of it these are not "private", in other words can be used safely by developers without Apple blocking your app from AppStore.

    Getting the Device Battery State

    1. var batteryLevel: Float (The battery charge level for the device).
    2. var isBatteryMonitoringEnabled: Bool (A Boolean value indicating whether battery monitoring is enabled (true) or not (false)).
    3. var batteryState: UIDevice.BatteryState (The battery state for the device).
    4. enum UIDevice.BatteryState (The battery power state of the device).