Question: I am writing my own background location updates for interval of every 5 minutes in android. I would like to know the difference between setInterval and setFastestInterval 

When I setInterval to 5 mins and setFastestInterval to 2 mins. The location update is called every 2 mins.

I would like to know the difference. I couldn't understand what exactly is written in the developer page for this <https://developer.android.com/reference/com/google/android/gms/location/LocationRequest.html>

Also: Is there an inbuilt function to check the location updates only if the distances of the first update are more than 20meters with the second update? 

Thanks!

Answer: 
> 
> Also: Is there an inbuilt function to check the location updates only if the distances of the first update are more than 20meters with the second update?
> 
> 
> 

LocationRequest has a method you can use to set the minimum distance between updates.

```
int minimumDistanceBetweenUpdates = 20;

LocationRequest request = new LocationRequest();
request.setMinimumDisplacement(minimumDistanceBetweenUpdates);
// ... request.setInterval(interval); etc

```
setInterval (long millis)
This interval is inexact. You may not receive updates at all (if no location sources are available), or you may receive them slower than requested. You may also receive them faster than requested (if other applications are requesting location at a faster interval). The fastest rate that that you will receive updates can be controlled with setFastestInterval(long). By default this fastest rate is 6x the interval frequency.

setFastestInterval (long millis)
Unlike setInterval(long), this parameter is exact. Your application will never receive updates faster than this value.
If you don't call this method, a fastest interval will be selected for you. It will be a value faster than your active interval (setInterval(long)).