'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'
Solution 1:[1]
in my case i was importing wrong file.
this is right file "import com.google.android.gms.location.LocationRequest;"
Solution 2:[2]
Number 0 is the right answer but that import
import com.google.android.gms.location.LocationRequest;
is deprecated. I use that line and it solve the problems. But it need to be updated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rushab |
| Solution 2 | Cristiam Guevara Gutierrez |
