2

i am having trouble with adding more then one proximity alert to my location listener. i already searched the internet but found nothing helpful. please let me know if i am doing some thing wrong . here is my code snippet

    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));

From my emulator control when i give 30.0 and 70.0 nothing happen but when i give 40.0 and 50.0 my pending intent trigger. i want to add both these locations to my location manager's proximity alert

StarsSky
  • 6,721
  • 6
  • 38
  • 63
Usman Riaz
  • 2,920
  • 10
  • 43
  • 66

1 Answers1

2

You should use BroadcastReceiver and BroadcastMessages to manage more thant one proximity alert. When you add the second alert 40.0, 50.0, you overwrite the first alert. A good solution is here.

Community
  • 1
  • 1
StarsSky
  • 6,721
  • 6
  • 38
  • 63