Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Created March 13, 2015 01:22
Show Gist options
  • Save arturoleon/b1ca583f5313527bd254 to your computer and use it in GitHub Desktop.
Save arturoleon/b1ca583f5313527bd254 to your computer and use it in GitHub Desktop.
Geolocalización con Titanium
// Para compatibilidad con Android en modo automático
Ti.Geolocation.setAccuracy(Ti.Geolocation.ACCURACY_HIGH);
// Obtener ubicación por única vez
Ti.Geolocation.getCurrentPosition(function(e){
alert("obteniendo por única vez: "+
e.coords.latitude+","+e.coords.longitude);
});
// Obtener ubicación cada que cambie
Ti.Geolocation.addEventListener('location',function(e){
console.log("obteniendo ubicación cada que cambia: "+
e.coords.latitude+","+e.coords.longitude);
});
$.index.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment