Quantcast
Viewing all articles
Browse latest Browse all 8068

reverseGeocoder problem

I have a problem with the function reverseGeocoder, I can not get the address. It is a temporary problem? Until yesterday it worked properly.

var locationCallbackIOS = function(e) {
    if (e.error) {
 
            Ti.API.info('locationCallbackIOS error: ' + e.error);
    } else {
 
            Ti.API.info("coords: " + JSON.stringify(e));
            Ti.API.info("lat: " + e.coords.latitude);
            Ti.API.info("long: " + e.coords.longitude);
 
    }
};
 
// locationServicesEnabled check
if (Ti.Geolocation.locationServicesEnabled) {
 
        Ti.Geolocation.purpose = 'This app use your position to get data';
        Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
        Ti.Geolocation.distanceFilter = 100;
        Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
        Ti.Geolocation.trackSignificantLocationChange = true;
 
} else {    
    Ti.UI.createAlertDialog({
        title : "MyApp",
        message : "Enable location services to take advantage of all features"
    }).show();
}
 
 
Ti.Geolocation.addEventListener('location', locationCallbackIOS);
 
 
Titanium.Geolocation.getCurrentPosition(function(e){        
    if (e.error) {
        var alertDialog =   Ti.UI.createAlertDialog({
            title : "MyApp",
            message : "Enable location services to take advantage of all features"
        });
        alertDialog.show();
    }
    else {
        Ti.API.info("getCurrentPosition Data: " + JSON.stringify(e));
        var mylongitude = e.coords.longitude;
        var mylatitude = e.coords.latitude;
        altitude = e.coords.latitude;
 
        Titanium.Geolocation.reverseGeocoder(mylatitude, mylongitude, function(evt){                
 
            Ti.API.info(JSON.stringify(evt));
 
            if(evt.error){
                var alertDialog =   Ti.UI.createAlertDialog({
                    title : "MyApp",
                    message : "A connection failure occurred. Please, try again."
                });
                alertDialog.show();                 
 
                return;                 
            };              
            var places = evt.places;
 
            for(i in places){
                Ti.API.info("my position could be...: " + places[i].address);
            };
 
        });             
    }
 
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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