当您收到 addProximityAlert 的响应时,您如何知道您得到的是哪个设置?

发布于 2024-09-07 04:40:39 字数 742 浏览 0 评论 0原文

我通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

杀お生予夺 2024-09-14 04:40:39

例如,在包装在 PendingIntent 中的 Intent 上使用自定义操作字符串,以便您可以区分不同的意图。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文