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

error location

$
0
0

This is the code that works

if (Ti.Geolocation.locationServicesEnabled) {
    Ti.Geolocation.purpose = 'Get Current Location';
    Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HUNDRED_METERS;
    Ti.Geolocation.distanceFilter = 10;
    Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
    Ti.Geolocation.addEventListener('location', function(e) {
        if (e.error) {
            alert('Error: ' + e.error);
        } else {
            Ti.API.info(e.coords);
            latitudine=e.coords.latitude;
            longitudine=e.coords.longitude;
        }
    });
} else {
    alert('Please enable location services');
 }
the question is, at the first launch of the IOS simulator it doesn't retrieve the location and i read the follow alert "error location"....waiting for some seconds the coordinate are correctly retrieved from the simulator.

Is a problem only on simulator or should i expect the same malfunctioning on the device ? How can i fix that ?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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