2

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

    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 时,我的待定意图触发器。我想将这两个位置都添加到我的位置管理器的邻近警报中

4

1 回答 1

2

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

于 2013-02-03T09:54:13.907 回答