I’m using next function to set proximityAlerts:
public void addProximityAlerts(double latitude, double longitude, double radius)
{
try{
//Prepare proximity Intent
proximityIntent = new Intent(activityContext.getString(R.string.intent_message_location_fetched));
proximityPendingIntent = PendingIntent.getBroadcast(activityContext, 0, proximityIntent, PendingIntent.FLAG_CANCEL_CURRENT);
locationManager.addProximityAlert(latitude, longitude, (float) radius, -1, proximityPendingIntent);
}
catch (Exception e) {
Log.d("ERROR", e.toString());
SendHandle(LOCATION_ADDING_ALERTS_FAILED);
}
}
And call this:
location.addProximityAlerts(33.3333, 33.3333, 1000);
location.addProximityAlerts(12, 12, 5000);
location.addProximityAlerts(42, 42, 5000);
But Intent fired only when I’m around 42, 42 – the last used location.
What’s wrong? Shouldn’t alerts work with all given points?
Action must be unique!
Thank this
Now I’m creating receiver in the addProximityAlerts finction using
as unique action