How to update the parameters of LocationServices.FusedLocationApi.requestLocationUpdates

347 views Asked by At

Developing an application where user location is tracked and distance is calculated from the destination. Now as location tracking is kind of heavy process, iam using LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY when the distance from destination is large than a particular threshold value. When the User approcahes destination, LocationRequest.PRIORITY_HIGH_ACCURACY mode will be used. Also the INTERVAL and FASTEST_INTERVAL will change accordingly.

What is the best way to change the parameter of

LocationServices.FusedLocationApi.requestLocationUpdates(
        mGoogleApiClient, mLocationRequest, this); 

I've to change mLocationRequest parameters based on the current distance of the User from the destination.

Iam thinking of stopping the location updates and then starting again with new parameters. Is it the correct way?

Refer: Receiving Location Updates

0

There are 0 answers