0

[So i have that problem that it gives me an error like:

error: incompatible types: <anonymous LocationCallback> cannot be converted to PendingIntent
                LocationServices.getFusedLocationProviderClient(getActivity()).requestLocationUpdates(locationRequest, new LocationCallback() {

So how can i get over it ? I want to find the address of the user and update it. I have also fragments that i have to write "this" instead of getActivity() but it gives an error each way.]1

1 Answers1

0

In the photo attached the error is shown because you have not rewritten the code completely you are missing the 3rd parameter looper

your code should be something like

LocationServices.getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, new LocationCallback() {
                    @Override
                    public void onLocationResult(LocationResult locationResult) {
                        //All your code for parsing or extracting data
                    }
                },
                Looper.myLooper()); 
Dinkar Kumar
  • 2,175
  • 2
  • 12
  • 22