Created
January 21, 2015 02:58
-
-
Save arturoleon/5a34d8b429ca5d5a6e71 to your computer and use it in GitHub Desktop.
Actualizar ubicación del usuario.
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
Ti.Geolocation.getCurrentPosition(function(e){ | |
if(e.success){ | |
// Actualizamos etiqueta | |
$.ubicacion.setText(e.coords.longitude + ", " + e.coords.latitude); | |
var coordenadas = [e.coords.longitude, e.coords.latitude]; | |
// Actualizamos perfil de usuario | |
Cloud.Users.update({ | |
custom_fields: { | |
coordinates: coordenadas | |
} | |
}, function (u) { | |
console.log("Actualizando localización de usuario: "+u.success); | |
if (!u.success) { | |
console.log(u.message); | |
alert("Error actualizando usuario."); | |
} | |
}); | |
}else{ | |
console.log(e.message); | |
alert("Error obteniedo ubicación."); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment