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

前端 未结 4 1808
一个人的身影
一个人的身影 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:34

    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)).

提交回复
热议问题