Created
October 7, 2011 17:55
-
-
Save aaronksaunders/1270930 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 LISTENER | |
| Ti.App.addEventListener('location.updated',function(coords){ | |
| Ti.API.debug(JSON.stringify(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)); | |
| // fire and event containing the location information | |
| Ti.App.fireEvent('location.updated',e.coords); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment