Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Ti.Map question(s)

$
0
0

Hi there! I'm developing an app which take the user location. Here's the code I use:

Titanium.Geolocation.distanceFilter = 1;
Titanium.Geolocation.purpose = 'I would know your position...';
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
 
function startLocationServices(e){
    if ( e.success ){
        started = true;
        location.latitude = e.coords.latitude;
        location.longitude = e.coords.longitude;
    }
}; 
 
if ( Titanium.Geolocation.getLocationServicesEnabled() ){
    Titanium.Geolocation.removeEventListener('location',startLocationServices); 
}
This code is clearly the only way to obtain user's coords which aren't cached. But it takes a lot of time before obtain correct latitude and longitude; so I'm trying a different way. If I try to open a mapview with new map module, with userLocation property set to true it takes location correctly in less time then code provided. So, question(s) is:
  • How can I get userLocation coords from mapview?
  • Can I center the mapview to the userLocation?

Thanks a lot!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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