Commit 14acd263 authored by Chris Scott's avatar Chris Scott

only nullify stationary-region when isMoving

parent ce3a6c7c
...@@ -138,6 +138,9 @@ ...@@ -138,6 +138,9 @@
UIApplicationState state = [[UIApplication sharedApplication] applicationState]; UIApplicationState state = [[UIApplication sharedApplication] applicationState];
if (state == UIApplicationStateBackground) { if (state == UIApplicationStateBackground) {
[self setPace:isMoving]; [self setPace:isMoving];
if (!isMoving) {
[self startMonitoringStationaryRegion:[locationManager location]];
}
} }
} }
/** /**
...@@ -278,13 +281,13 @@ ...@@ -278,13 +281,13 @@
*/ */
- (void)setPace:(BOOL)value - (void)setPace:(BOOL)value
{ {
NSLog(@"- CDVBackgroundGeoLocation setPace %d", value); NSLog(@"- CDVBackgroundGeoLocation setPace %d, myRegion? %d", value, myRegion!=nil);
isMoving = value; isMoving = value;
if (value == YES) {
if (myRegion != nil) { if (myRegion != nil) {
[locationManager stopMonitoringForRegion:myRegion]; [locationManager stopMonitoringForRegion:myRegion];
myRegion = nil; myRegion = nil;
} }
if (value == YES) {
[locationManager stopMonitoringSignificantLocationChanges]; [locationManager stopMonitoringSignificantLocationChanges];
[locationManager startUpdatingLocation]; [locationManager startUpdatingLocation];
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment