当您收到 addProximityAlert 的响应时,您如何知道您得到的是哪个设置?
我通过 addProximityAlert 向系统添加大量 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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如,在包装在
PendingIntent
中的Intent
上使用自定义操作字符串,以便您可以区分不同的意图。Use a custom action string on your
Intent
s that you wrap in thePendingIntent
s, so you can tell the different ones apart, for example.