I am using Google Play services to get current location. When I am using requestLocationUpdates
method it gives red lines saying;
Incompatible types. Required: android.location.Location. Found:com.google.android.gms.common.api.PendingResult
mLastLocation = LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
this
refers to LocationListener. I already implement com.google.android.gms.location.LocationListener and override onLocationChanged
method but still red line exists. To be able to sure I tried this version also;
mLastLocation = LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
}
});
This also gives same error. Method parameters are GoogleApiClient, LocationRequest, LocationListener. I don't understand where is the mistake. Any idea ? Thanks in advance.