Get Battery State

Turn on battery monitoring for your app [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; Getting The Current State //—– DISPLAY BATTERY STATE —– if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateUnknown) { [BatteryStateLabel setText:@””]; } else { NSString *BatteryString = [NSString stringWithFormat:@”Battery: %0.0f%%”, [[UIDevice currentDevice] batteryLevel] * 100]; switch ([[UIDevice currentDevice] batteryState]) { case 1: //Battery is in use (discharging) break; […]

Read More