Created
October 7, 2011 17:39
-
-
Save aaronksaunders/1270894 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; | |
| Titanium.Geolocation.distanceFilter = .25; | |
| Ti.Geolocation.purpose = "Callbacks Are Your Friend"; | |
| // global to hold the coords from the callback | |
| var global_var_coords; | |
| // make the API call | |
| Ti.Geolocation.getCurrentPosition(function(e) { | |
| // do this stuff when you have a position, OR an error | |
| if (e.error) { | |
| Ti.API.error('geo - current position' + e.error); | |
| return; | |
| } | |
| // got the location information | |
| Ti.App.info('got a location ',JSON.stringify(e)); | |
| // set a global variable | |
| global_var_coords = e.coords | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment