Skip to content

Commit

Permalink
Merge pull request #2787 from srahim/timob-10041.addition-2_1_X
Browse files Browse the repository at this point in the history
[Timob-10041]Ensure trackSignificatLocationUpdate is only used on devices that support it.
  • Loading branch information
Max Stepanov committed Aug 21, 2012
2 parents 3fb158e + 50cd81e commit 3046311
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions iphone/Classes/GeolocationModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -622,22 +622,27 @@ -(NSNumber*)trackSignificantLocationChange

-(void)setTrackSignificantLocationChange:(id)value
{
BOOL newval = [TiUtils boolValue:value def:YES];

if (newval != trackSignificantLocationChange) {
if ( trackingLocation && locationManager != nil ) {
[lock lock];
[self shutdownLocationManager];
trackingHeading = NO;
trackingLocation = NO;
trackSignificantLocationChange = newval;
[lock unlock];
TiThreadPerformOnMainThread(^{[self startStopLocationManagerIfNeeded];}, NO);
return ;
if ([CLLocationManager significantLocationChangeMonitoringAvailable]) {
BOOL newval = [TiUtils boolValue:value def:YES];

if (newval != trackSignificantLocationChange) {
if ( trackingLocation && locationManager != nil ) {
[lock lock];
[self shutdownLocationManager];
trackingHeading = NO;
trackingLocation = NO;
trackSignificantLocationChange = newval;
[lock unlock];
TiThreadPerformOnMainThread(^{[self startStopLocationManagerIfNeeded];}, NO);
return ;
}
}
trackSignificantLocationChange = newval;
}
else{
trackSignificantLocationChange = NO;
DebugLog(@"[WARN] Ti.Geolocation.setTrackSignificantLocationChange is not supported on this device.");
}

trackSignificantLocationChange = newval;
}

-(void)restart:(id)arg
Expand Down

0 comments on commit 3046311

Please sign in to comment.