getlastknownlocation always return null after I re-install the apk file via eclipse

Try Following Code

LocationManager locationManager = (LocationManager) getActivity()
            .getSystemService(Context.LOCATION_SERVICE);

    String locationProvider = LocationManager.NETWORK_PROVIDER;
    Location lastlocation = locationManager.getLastKnownLocation(locationProvider);

    String CurLat = String.valueOf(lastlocation.getLatitude());
    String Curlongi= String.valueOf(lastlocation.getLongitude());

Leave a Comment