I am facing a issue with getting latitude longitude using FusedLocationProviderClient only in Android Pie, I got the correct location below Android Version 9.0(Pie)
Every time I called getLocation() FusedLocationProviderClient provides same lat long.
mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
if (location != null) {
wayLatitude = location.getLatitude();
wayLongitude = location.getLongitude();
Log.e("Location11", "" + String.format(Locale.US, "%s - %s", wayLatitude, wayLongitude));
} else {
mFusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, null);
}
}
});
I got same lat long everytime. like latitude- 28.303303303303 longtitude- 77.411411411