Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Timob-10041]Ensure trackSignificatLocationUpdate is only used on devices that support it. #2787

Merged
merged 4 commits into from
Aug 21, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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