Hi I'm new in stackoverflow. I hope someone Know how to do something in Android to call method requestLocationUpdates using FusedLocationApi.
I'm trying to call in a non-activity class that implements the classes nedded to request location updates: LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
But it shows message that "Cannot resolve method requestLocationUpdates(...)"
/**
* Requests location updates from the FusedLocationApi.
*/
protected void startLocationUpdates() {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
And the non-activity class that I use implements ConnectionCallbacks, OnConnectionFailedListener and LocationListener and extends my activity class.
public class OnMapGps extends OnActivity implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {
...
...
}
The error that shows is:
Error:(306, 42) error: no suitable method found for requestLocationUpdates(GoogleApiClient,LocationRequest,OnMapGps)
method FusedLocationProviderApi.requestLocationUpdates(GoogleApiClient,LocationRequest,LocationListener)
is not applecable (argument mismatch; OnMapGps cannot be converted to LocationListener)