Skip to content

Instantly share code, notes, and snippets.

@junerockwell
Last active August 29, 2015 14:07
Show Gist options
  • Save junerockwell/a0b6e39d6832a36a0d8b to your computer and use it in GitHub Desktop.
Save junerockwell/a0b6e39d6832a36a0d8b to your computer and use it in GitHub Desktop.
Gist of code to show to Titanium JIRA
Ti.Geolocation.purpose = 'Find Nearby Trails';
if (Ti.Geolocation.locationServicesEnabled) {
if (OS_IOS) {
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
Ti.Geolocation.activityType = Ti.Geolocation.ACTIVITYTYPE_FITNESS;
} else if (OS_ANDROID) {
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HIGH;
}
Ti.Geolocation.getCurrentPosition(function(e) {
if (!e.error) {
alert("Lat: " + e.coords.latitude + ";\nlong: "+ e.coords.longitude);
}
else {
alert("turn on location services.");
}
}
else {
alert("Please turn on your location services.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment