Difference between LocationRequest setInterval (long millis) and LocationRequest setFastestInterval (long millis)

前端 未结 4 1819
一个人的身影
一个人的身影 2021-01-31 06:52

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

4条回答
  •  长情又很酷
    2021-01-31 07:28

    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
    

提交回复
热议问题