nilai
V2EX  ›  Android

百度地图如何判定位置是否改变

  •  
  •   nilai · May 17, 2014 · 13925 views
    This topic created in 4454 days ago, the information mentioned may be changed or developed.
    现在就算手机放在那里不动,获取到的坐标还是不一样. 如何判断位置是否改变,如果没有发生改变就不记录坐标地址..
    2 replies    2014-05-17 19:09:52 +08:00
    likaci
        1
    likaci  
       May 17, 2014
    好久不用百度的sdk了,应该提供类似的容差吧。不行的话直接比较两次的值也可以。

    Android api 是可以的

    public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, LocationListener listener)

    The minDistance parameter can also be used to control the frequency of location updates. If it is greater than 0 then the location provider will only send your application an update when the location has changed by at least minDistance meters, AND at least minTime milliseconds have passed.
    adeweb
        2
    adeweb  
       May 17, 2014
    计算经纬度的偏移量,小于某个范围就不记录。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:04 · PVG 04:04 · LAX 13:04 · JFK 16:04
    ♥ Do have faith in what you're doing.