Skip to content

Instantly share code, notes, and snippets.

@bvibber
Created November 23, 2011 20:38
Show Gist options
  • Save bvibber/1389827 to your computer and use it in GitHub Desktop.
Save bvibber/1389827 to your computer and use it in GitHub Desktop.
e114a353 PhoneGapLib/Classes/Location.m (Becky Gibson 2011-09-08 02:46:30 +0800 178)
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 179) // Tell the location manager to start notifying us of location updates
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 180) }
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 181)
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 182) // Tell the location manager to start notifying us of location updates. We
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 183) // first stop, and then start the updating to ensure we get at least one
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 184) // update, even if our location did not change.
5b7dae9e PhoneGapLib/Classes/Location.m (Matthew Schulkind 2011-11-15 00:20:36 -0500 185) [self.locationManager stopUpdatingLocation];
559b9367 iphone/Classes/Location.m (Brock Whitten 2009-03-08 12:39:51 -0700 186) [self.locationManager startUpdatingLocation];
bc8fc38c iphone/Classes/Location.m (shazron 2009-07-16 18:56:15 -0700 187) __locationStarted = YES;
72301215 iphone/Classes/Location.m (Rob Ellis 2009-02-04 23:09:05 -0800 188)
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 189) if ([options objectForKey:kPGLocationDistanceFilterKey])
7b30721e PhoneGapLib/Classes/Location.m (Jesse MacFadyen 2010-07-17 13:46:33 -0700 190) {
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 191) CLLocationDistance distanceFilter = [(NSString *)[options objectForKey:kPGLocationDistanceFilterKey] doubl
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 192) self.locationManager.distanceFilter = distanceFilter;
559b9367 iphone/Classes/Location.m (Brock Whitten 2009-03-08 12:39:51 -0700 193) }
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 194)
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 195) if ([options objectForKey:kPGLocationDesiredAccuracyKey])
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 196) {
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 197) int desiredAccuracy_num = [(NSString *)[options objectForKey:kPGLocationDesiredAccuracyKey] integerValue];
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 198) CLLocationAccuracy desiredAccuracy = kCLLocationAccuracyBest;
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 199)
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 200) if (desiredAccuracy_num < 10) {
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 201) desiredAccuracy = kCLLocationAccuracyBest;
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 202) }
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 203) else if (desiredAccuracy_num < 100) {
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 204) desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 205) }
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 206) else if (desiredAccuracy_num < 1000) {
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 207) desiredAccuracy = kCLLocationAccuracyHundredMeters;
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 208) }
2169802b PhoneGapLib/Classes/Location.m (shazron 2011-09-12 19:12:32 -0700 209) else if (desiredAccuracy_num < 3000) {
f091f294 iphone/Classes/Location.m (Michael Nachbaur 2009-04-16 16:45:17 -0700 210) desiredAccuracy = kCLLocationAccuracyKilometer;
grendel:callback-ios brion$ git show 5b7dae9e
commit 5b7dae9e8130c65dc46ae9198d0e0eda4d9e3732
Author: Matthew Schulkind <[email protected]>
Date: Tue Nov 15 00:20:36 2011 -0500
Fixed #197 errors on repeated getCurrentPosition calls.
diff --git a/PhoneGapLib/Classes/Location.m b/PhoneGapLib/Classes/Location.m
index b062590..e88dadd 100755
--- a/PhoneGapLib/Classes/Location.m
+++ b/PhoneGapLib/Classes/Location.m
@@ -177,6 +177,12 @@
}
// Tell the location manager to start notifying us of location updates
+ }
+
+ // Tell the location manager to start notifying us of location updates. We
+ // first stop, and then start the updating to ensure we get at least one
+ // update, even if our location did not change.
+ [self.locationManager stopUpdatingLocation];
[self.locationManager startUpdatingLocation];
__locationStarted = YES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment