Skip to content
Permalink
Browse files
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 <shazron@apache.org>
  • Loading branch information
markwpearce authored and shazron committed Sep 15, 2014
1 parent 4102a33 commit 551b40458c208e23be0005f25ad8a5c896f3aa9f
Showing 1 changed file with 3 additions and 0 deletions.
@@ -267,6 +267,9 @@ - (void)clearWatch:(CDVInvokedUrlCommand*)command

if (self.locationData && self.locationData.watchCallbacks && [self.locationData.watchCallbacks objectForKey:timerId]) {
[self.locationData.watchCallbacks removeObjectForKey:timerId];
if([self.locationData.watchCallbacks count] == 0) {
[self _stopLocation];
}
}
}

0 comments on commit 551b404

Please sign in to comment.