Android 当您从addProximityAlert收到响应时,您如何知道它是针对哪个设置的?

Android 当您从addProximityAlert收到响应时,您如何知道它是针对哪个设置的?,android,proximity,Android,Proximity,我通过向系统添加了很多POI。 当我收到警报时,我不知道发生了哪个设置 唯一需要传递的额外信息是文档中描述的“输入”标志 我怎么知道 答案后面是工作代码: Intent intent = new Intent(this, PlacesProximityHandlerService.class); intent.setAction("PlacesProximityHandlerService"); intent.putExtra("lat", objPlace.getLat()); intent.

我通过向系统添加了很多POI。 当我收到警报时,我不知道发生了哪个设置

唯一需要传递的额外信息是文档中描述的“输入”标志

我怎么知道

答案后面是工作代码:

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

在您的
Intent
s上使用一个自定义动作字符串,将其包装在
pendingent
s中,以便您可以区分不同的动作字符串