Search code examples
iphoneiosobjective-cbluetoothbattery

Corebluetooth connection how to save battery level while it is connected


Am going to use core bluetooth framework to my application.But i would like to know when i am connecting with another BLE device with long period of time in this situation how do i handle battery level, because it will reduce too fast while connection.


Solution

  • Here is the example how you can get battery level

    UIDevice *device = [UIDevice currentDevice];
    [device setBatteryMonitoringEnabled:YES];
    float level = [device batteryLevel];