0
I’m trying to use google play service to get the user’s position. The problem is, I have a dynamic time frame for sending this position to the server. However, Locationclient does not respect this range, regardless of the value it has, the position update takes place in a fixed range of 5 s.
Could someone help me?
The code:
private LocationClient locationClient;
public void iniciarBusca(long updateInterval, long fastestInterval) {
mLocationRequest = LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(updateInterval);
mLocationRequest.setFastestInterval(fastestInterval);
locationClient = new LocationClient(activity, this, this);
locationClient.connect();
}
public void disconectar() {
try {
locationClient.disconnect();
} catch (Exception e) {
}
}
What value are you putting to the
fastestInterval
?– rsicarelli
Is dynamic, is the same value that is calculated for updateInterval.
– franM
What are the values you expect for these two fields? When you use fastestInterval, you are telling Play Services that your Location is dynamic, that is, it is calculated based on battery state, network, accuracy etc., what may be happening is that Play Services is calculating this time for you.
– rsicarelli