【问题标题】:Adding multiple proximity alerts to location manager向位置管理器添加多个接近警报
【发布时间】:2013-02-03 18:03:20
【问题描述】:

我无法向我的位置监听器添加一个以上的接近警报。我已经搜索了互联网,但没有发现任何帮助。如果我做错了什么,请告诉我。这是我的代码 sn-p

    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    locationManager.addProximityAlert(30.0, 70.0, 1000, -1, PendingIntent.getActivity(Map.this, 0, new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://www.google.com")), 0));

    locationManager.addProximityAlert(40.0, 50.0, 1000, -1, PendingIntent.getActivity(Map.this, 10, new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://www.google.com")),0));

当我给 30.0 和 70.0 时,从我的模拟器控制中什么都没有发生,但是当我给 40.0 和 50.0 时,我的待定意图触发器。我想将这两个位置都添加到我的位置管理器的邻近警报中

【问题讨论】:

    标签: android android-intent locationmanager


    【解决方案1】:

    您应该使用BroadcastReceiverBroadcastMessages 来管理多个接近警报。添加第二个警报40.0, 50.0 时,您会覆盖第一个警报。 一个好的解决方案是here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-29
      • 1970-01-01
      • 1970-01-01
      • 2018-07-14
      • 2020-02-28
      • 2016-08-20
      • 1970-01-01
      相关资源
      最近更新 更多