You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/09/16 00:15:27 UTC

git commit: CB-7556 - iOS: Clearing all Watches does not stop Location Services

Repository: cordova-plugin-geolocation
Updated Branches:
  refs/heads/master 4102a332b -> 551b40458


CB-7556 - iOS: Clearing all Watches does not stop Location Services

iOS shows a little arrow in the status bar if location services are in use. When you set a watch on Location Manager, it starts tracking position, and the arrow symbol appears. However, when that watch is cleared, no command to Location Manager is sent to stop tracking, so the arrow stays visible, even though in reality, the app is not using location services. My guess is that this also impacts battery life to some extent, especially if your iOS app has background location enabled.

This fix would automatically stop tracking location once all watched are cleared, so that the arrow symbol in the iOS status will disappear.

Tested on iOS 7.1.2.

Signed-off-by: Shazron Abdullah <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/551b4045
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/551b4045
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/551b4045

Branch: refs/heads/master
Commit: 551b40458c208e23be0005f25ad8a5c896f3aa9f
Parents: 4102a33
Author: Mark Pearce <ma...@gmail.com>
Authored: Mon Sep 15 16:43:08 2014 -0300
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Sep 15 15:09:45 2014 -0700

----------------------------------------------------------------------
 src/ios/CDVLocation.m | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/551b4045/src/ios/CDVLocation.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVLocation.m b/src/ios/CDVLocation.m
index 7c73b64..f82b52a 100644
--- a/src/ios/CDVLocation.m
+++ b/src/ios/CDVLocation.m
@@ -267,6 +267,9 @@
 
     if (self.locationData && self.locationData.watchCallbacks && [self.locationData.watchCallbacks objectForKey:timerId]) {
         [self.locationData.watchCallbacks removeObjectForKey:timerId];
+        if([self.locationData.watchCallbacks count] == 0) {
+            [self _stopLocation];
+        }
     }
 }