How to show current location point on alert (Geolocation in titanium ) in titatnium.I don't find any good tutorial for that . .can you please give some example.
I find some where this First, you will need to define why you want to use the geolocation. This message will be displayed to the user. Ti.Geolocation.purpose = "Location will be used for app X"; What is use of this line ? can we write anything here intead of this line Location will be used for app X
I am using this simple code, you can print an alert with latitude and longitude variables:
if(Ti.Network.online){
Ti.Geolocation.purpose = "Receive User Location";
Titanium.Geolocation.getCurrentPosition(function(e){
if (!e.success || e.error)
{
alert('Could not find the device location');
return;
}
var longitude = e.coords.longitude;
var latitude = e.coords.latitude;
alert("latitude: " + latitude + "longitude: " + longitude);
});
}else{
alert("Internet connection is required to use localization features");
}