I want to get driver current location in uber clone. When I write this code:
locationRequest=LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(5000);
locationRequest.setFastestInterval(1000);
I get the error:
Cannot resolve method 'create' in 'LocationRequest'
And when I write
mLocationRequest=new LocationRequest();
I get this error:
'LocationRequest()' has private access in 'android.location.LocationRequest'
num 1
num 2
LocationRequest.Builder works with 1 or 2 parameters.
This is the code that worked for me :
 mLocationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 1000)
                .setWaitForAccurateLocation(false)
                .setMinUpdateIntervalMillis(500)
                .setMaxUpdateDelayMillis(1000)
                .build();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With