Skip to content

Commit

Permalink
fix(battery_plus): battery state always unknown (iOS only) (#2481)
Browse files Browse the repository at this point in the history
  • Loading branch information
rostopira committed Feb 4, 2024
1 parent 39a1585 commit ea892fb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ - (void)sendBatteryStateEvent {
}

- (NSString *)getBatteryState {
UIDeviceBatteryState state = [[UIDevice currentDevice] batteryState];
UIDevice *device = UIDevice.currentDevice;
device.batteryMonitoringEnabled = YES;
UIDeviceBatteryState state = [device batteryState];
switch (state) {
case UIDeviceBatteryStateUnknown:
return @"unknown";
Expand Down

0 comments on commit ea892fb

Please sign in to comment.