How to obtain extensive battery info in iOS?

后端 未结 5 609
轻奢々
轻奢々 2021-01-13 12:46

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

5条回答
  •  醉梦人生
    2021-01-13 13:16

    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).

提交回复
热议问题