Reputation: 1269
I'm following this example from http://developer.android.com to get location updates. I get the following error when trying to call the LocationServices.FusedLocationApi.requestLocationUpdates()
method. Please help me resolve this.
When I let Android Studio
fix the issue for me, it does the following:
This, however, results in the following error:
java.lang.ClassCastException: com.example.user.myapplication.MainActivity cannot be cast to com.google.android.gms.location.LocationListener
Upvotes: 0
Views: 643
Reputation: 1
my solution was import com.google.android.gms.location.LocationListener; and delete import android.location.LocationListener;
Upvotes: 0
Reputation: 1269
Phew! I had forgotten to implement the LocationListener
class in my activity.java
like so:
public class MainActivity extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { ... }
Upvotes: 1