我无法向我的位置监听器添加多个接近警报。我已经在互联网上搜索但没有发现任何有用如果我做错了,请告诉我。这是我的代码片段
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我的待定意图触发器时。我想将这两个位置添加到我的位置经理的近距离警报
答案 0 :(得分:2)
您应该使用BroadcastReceiver
和BroadcastMessages
来管理多个邻近警报。添加第二个警报40.0, 50.0
时,会覆盖第一个警报。
一个很好的解决方案是here。