From e7518d56c52d8f8ffd50ad24246de2a3ad96b0ee Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 20 Apr 2015 10:59:09 -0500 Subject: [PATCH] #1303 - Enabling Battery Monitoring for app. Formatting battery level to int instead of float. --- platform/ios/MGLMapboxEvents.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 605c6a3fa..e4014d494 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -177,6 +177,9 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; [NSTimeZone resetSystemTimeZone]; [_rfc3339DateFormatter setTimeZone:[NSTimeZone systemTimeZone]]; + // Enable Battery Monitoring + [UIDevice currentDevice].batteryMonitoringEnabled = YES; + _isPaused = NO; } return self; @@ -300,7 +303,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; [evt setValue:weakSelf.model forKey:@"model"]; [evt setValue:weakSelf.iOSVersion forKey:@"operatingSystem"]; [evt setValue:[weakSelf getDeviceOrientation] forKey:@"orientation"]; - [evt setValue:@(100 * [UIDevice currentDevice].batteryLevel) forKey:@"batteryLevel"]; + [evt setValue:@((int)(100 * [UIDevice currentDevice].batteryLevel)) forKey:@"batteryLevel"]; [evt setValue:@(weakSelf.scale) forKey:@"resolution"]; [evt setValue:weakSelf.carrier forKey:@"carrier"];