Skip to content
Advertisement

android LocationRequest is private

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

Advertisement

Answer

Use LocationRequest.Builder(long intervalMillis) instead LocationRequest().

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement