I want to show battery usage of the app on the status bar of the app. It uses GPS, so GPS signal and details of battery usage by app would be useful for the users about the battery drain.
Is there a way to get the battery usage from the device? and to show only the amount of battery drained by my app alone. On instruments it shows the graph over the time.
I want to show battery usage in numerical format, not a graph.
From command line we can get the battery details of iOS phones using libimobiledevice tools.
Inside the tools use the command:
It will return something like:
BatteryCurrentCapacity: 30 BatteryIsCharging: true ExternalChargeCapable: true ExternalConnected: true FullyCharged: false GasGaugeCapability: true
Use below code to get battery level
will give you the battery between 0.0 (empty) and 1.0 (100% charged)
iOS - Issue with displaying battery status