Cannot resolve method 'requestLocationUpdates(String, int, int, LocationListener)'
try {
locationManager = (LocationManager) requireActivity().getSystemService(LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,3000,3,locationListener);
}
catch (Exception e){
e.printStackTrace();
}
when wrote this code it give me error why it happen I am not understand when I use the the dot after locationManager there are 9 function overloading and I used .requestLocationUpdates(String provider,minTimeMs,minDistanceM,locationListner );
but still getting error please anyone help me.
.requestLocationUpdates(String provider,minTimeMs,minDistanceM,locationListner );
I am using right one still getting if iam wrong one use please tell me
You have missed an argument in what you wrote. There is no method overloaded for requestLocationUpdates with just four arguments. There is, however, this one:
which I think is the one you were trying to invoke. Notice there is an extra argument of Executor type.
There is an explanation about the Executor in the documentation:
So in your case, you would need to add it to your call: