Created
April 16, 2015 12:58
-
-
Save rajubd49/04fbc14eff6a72398ff3 to your computer and use it in GitHub Desktop.
Get phone's location, altitude, accuracy and speed - Appcelerator Titanium
This file contains 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.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