Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

location geolocation

$
0
0

Hi there

I would like to see if there is really any way to get the latitude and longitude, have a good time working with the classic code of how to get the position, but it is never exact (200 meters away).

Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = 5;
 
var win = Ti.UI.createWindow({backgroundColor: '#fff'});
var label = Ti.UI.createLabel();
win.add(label);
win.open();
 
function reportPosition(e) {
if (!e.success || e.error) {
label.text = 'error: ' + JSON.stringify(e.error);
}
else {
var accuracy = e.coords.accuracy;
var timestamp = e.coords.timestamp;
var logitud = e.coords.longitude;
var latitud = e.coords.latitude;
label.text = 'geo time: ' + logitud + ', accuracy: ' + latitud;
}
}
 
// this fires once
Titanium.Geolocation.getCurrentPosition(reportPosition);
// this fires whenever the distance filter is surpassed
Titanium.Geolocation.addEventListener('location', reportPosition);
If I can help in this. Maybe some module or some system exists to help you make a correct position.

thank you


Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>