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

Get position on Android returning error

$
0
0

I'm trying to get the user's current position but always when I tried it returns network is disabled and Cant get user position but I can secure that my network is working.

this is the code:

// GEOLOCALIZAÇAO
var geo = function(){
    Ti.Geolocation.purpose = L('GeolocalizacaoCidades');
    //Filtro de distancia. Ex: 10 = 10 metros, a cada 10 metros vai mudar a geolocalizacao
    Ti.Geolocation.distanceFilter = 1;
    //Qualidade do sinal
    Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
 
    // Puxa posicao atual
    Ti.Geolocation.getCurrentPosition( function(e) {
 
        if ( !e.error ) {
 
            latitude = e.coords.latitude;
            longitude = e.coords.longitude;
 
            Ti.API.info( 'latitude: ' + latitude + ' longitude: ' + longitude );
 
        }else {
 
            var dialog = Ti.UI.createAlertDialog({
                    message: L('Erro_de_conexao'),
                    ok: L('Ok'),
                    title: 'Oops'
            }).show();
 
            win.remove( rectPreto );
            win.remove( viewLoading );
            Ti.API.info( 'e.error: ' + e.error );
        }
    });
};
geo();
Thanks Android 3.2.3

Viewing all articles
Browse latest Browse all 7655

Trending Articles