Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ios/CDVBattery.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ - (void)getBatteryStatus:(CDVInvokedUrlCommand*)command
// save callback id
self.callbackId = command.callbackId;

// get up to date battery info
self.getBattery = [self getBatteryInfo];

// register for battery changes
if ([UIDevice currentDevice].batteryMonitoringEnabled == NO) {
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
Expand All @@ -58,6 +55,9 @@ - (void)getBatteryStatus:(CDVInvokedUrlCommand*)command
name:UIDeviceBatteryLevelDidChangeNotification object:nil];
}

// get up to date battery info
self.getBattery = [self getBatteryInfo];

CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: self.getBattery];
[result setKeepCallbackAsBool:YES];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
Expand Down