When you get response from an addProximityAlert how do you know for which setup you got it?

StackOverflow https://stackoverflow.com/questions/3127925

  •  30-09-2019
  •  | 
  •  

문제

I add to system a lot of POIs via addProximityAlert. When I have got the alert, I don't know for which setting has occurred.

The only Extra that is passes is the 'entering' flag as it is described in the documentation.

How can I know that?

After the answers here is the working code:

Intent intent = new Intent(this, PlacesProximityHandlerService.class);
intent.setAction("PlacesProximityHandlerService");
intent.putExtra("lat", objPlace.getLat());
intent.putExtra("lon", objPlace.getLon());
intent.putExtra("error_m", objPlace.getError()+ALERT_RANGE_IN_METERS);
PendingIntent sender=PendingIntent.getService(this, 0, intent, 0);
LocationUtils.addProximity(this, objPlace.getLat(), objPlace.getLon(),objPlace.getError()+ALERT_RANGE_IN_METERS, -1, sender);
도움이 되었습니까?

해결책

Use a custom action string on your Intents that you wrap in the PendingIntents, so you can tell the different ones apart, for example.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top