summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-04-07 15:53:17 -0500
committerBrad Leege <bleege@gmail.com>2015-04-07 15:53:17 -0500
commite86597011f83022fd534c7cac2afe058b386b4b2 (patch)
tree2d434224ece98ea9cc3f8535e12ab5f795890a9e /platform
parent482275f978007ec30d098889729e61ba2a095b32 (diff)
downloadqtlocation-mapboxgl-e86597011f83022fd534c7cac2afe058b386b4b2.tar.gz
#1216 - Added test usage of pausing / resuming Metrics to simulate app entering background mode and no other location manager running. Added paused state checking to pauseMetricsCollection and resumeMetricsCollection
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapboxEvents.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index 0f3422b86d..346bd70aca 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -230,6 +230,9 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
//
+ (void) pauseMetricsCollection {
assert([[NSThread currentThread] isMainThread]);
+ if ([MGLMapboxEvents sharedManager].isPaused) {
+ return;
+ }
[MGLMapboxEvents sharedManager].isPaused = YES;
[MGLMetricsLocationManager stopUpdatingLocation];
}
@@ -238,6 +241,9 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
//
+ (void) resumeMetricsCollection {
assert([[NSThread currentThread] isMainThread]);
+ if (![MGLMapboxEvents sharedManager].isPaused) {
+ return;
+ }
[MGLMapboxEvents sharedManager].isPaused = NO;
[MGLMetricsLocationManager startUpdatingLocation];
}