【问题标题】:How to be sure that I stopped locationManager requestUpdates?如何确定我停止了 locationManager requestUpdates?
【发布时间】:2011-11-03 14:40:35
【问题描述】:

我正在寻找我当前位置的位置,但只有一次,我无法使用 requestSingleUpdate,因为它需要在低于 2.3 的 Android 版本上运行。我通过 TimerTask 调用它,当我得到位置时,我停止 timer.cancel()。如何确定我停止了 locationManager requestUpdates? (我调用了 locationManager.removeUpdates 但还有其他方法可以监控请求)

【问题讨论】:

    标签: android android-location


    【解决方案1】:

    如果你调用 timer.cancel,locationupdatelistener 会继续工作。您只能使用 locationManager.removeUpdates,这是 100% 安全的,停止更新

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-30
      • 2014-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多