A while ago I wrote a Unity program which logged GPS coordinates and it got a new location about 3 times a second while driving. I'm rewritting the app in Android Studio and using the fused location provider API. It is very slow and only getting GPS coordinates ever 5-15 seconds while driving. Here are some snips of my code which I believe influence the speed of getting a location.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
...
locationRequest = new LocationRequest();
locationRequest.setInterval(10);
locationRequest.setFastestInterval(15*1000);
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
...
@Override
public void onLocationChanged(Location location) {
myLatitude = location.getLatitude();
mylongitude = location.getLongitude();
....
In order for this app to be viable it needs to log GPS coordinates at least a few times per second. Should I go back to the android.location method for location even though it is advised against?
How do I speed up receiving GPS coordinates?