Skip to content

Instantly share code, notes, and snippets.

@rajubd49
Created April 16, 2015 12:58
Show Gist options
  • Save rajubd49/04fbc14eff6a72398ff3 to your computer and use it in GitHub Desktop.
Save rajubd49/04fbc14eff6a72398ff3 to your computer and use it in GitHub Desktop.
Get phone's location, altitude, accuracy and speed - Appcelerator Titanium
Titanium.Geolocation.getCurrentPosition(function(e)
{
if (!e.success || e.error)
{
currentLocation.text = 'error: ' + JSON.stringify(e.error);
Ti.API.info("Code translation: "+translateErrorCode(e.code));
alert('error ' + JSON.stringify(e.error));
return;
}
var longitude = e.coords.longitude;
var latitude = e.coords.latitude;
var altitude = e.coords.altitude;
var heading = e.coords.heading;
var accuracy = e.coords.accuracy;
var speed = e.coords.speed;
var timestamp = e.coords.timestamp;
var altitudeAccuracy = e.coords.altitudeAccuracy;
Ti.API.info('speed ' + speed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment