I'm using the FusedLocationApi to get updates. But in spite of setting the LocationRequest.setInterval to say 500 or even 200 millis, I only get one update per second. I'd like to get two a second if possible (to do a moving average of speed). Is there a hard limit?
In my onCreate for the Activity:
googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .addApi(AppIndex.API).build();
In my 'onConnected' method:
this.locationRequest = new LocationRequest(); this.locationRequest.setInterval(200); this.locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); LocationServices.FusedLocationApi.requestLocationUpdates(this.googleApiClient, this.locationRequest, this);
I also have a separate LocationManager I only use to get status changes via addGpsStatusListener() and those seem to work OK.
As the "LocationRequest.setInterval()" docs says
The location client will actively try to obtain location updates for your application at this interval[...]
So it's possible you cannot get the location updated in the desired frequency. That's because the nature of the location retrieving techniques (GPS, WiFi, etc.) and it's very hardware dependent (and also the Google's fused location provider algorithms), and also depends on the atmospheric conditions (in the GPS case). If you want to obtain a high accuracy location, then the device needs to obtain first some samples in order to do a high accuracy estimation.