Skip to content Skip to sidebar Skip to footer

Location Returns Always Null - Android

Location returns always null from this code. Please check my codes and tell me whats wrong. When I run the project on debug mode, provider='network' but location always null. I sen

Solution 1:

I think u should use LocationManager.GPS_PROVIDER to request. You can test my code:

mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1l,1f, new LocationListener() {        
    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
         // TODO Auto-generated method stub

    }

    @Override
    public void onProviderEnabled(String provider) {
    // TODO Auto-generated method stub

    }

    @Override
    public void onProviderDisabled(String provider) {
    // TODO Auto-generated method stub

    }

    @Override
    public void onLocationChanged(Location location) {
    // TODO Auto-generated method stubupdateLocation(location);               
    }
    });

Good luck! ^-^

Post a Comment for "Location Returns Always Null - Android"