AddProximityAlert 虽然过期 -1 但消失

发布于 2024-09-01 01:05:28 字数 187 浏览 2 评论 0原文

我希望我的应用程序有一个邻近警报,直到用户将其删除。我使用expiration -1 来创建这个proximityAlert。接近警报 作品。但我在我的 Droid 手机上发现,添加了proximityAlert后 并让手机过夜充电,proximityAlert 会 第二天不上班。我怎样才能确保我的proximityAlert是 无限期有效,除非用户删除它?

I want my app to have a proximityAlert until the user removes it. I use expiration -1 to create this proximityAlert. The proximityAlert
works. But I find on my Droid phone, after adding a proximityAlert
and leaving the phone over night for charging, the proximityAlert does
not work the next day. How can I make sure that my proximityAlert is
active indefinitely unless the user removes it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

太阳男子 2024-09-08 01:05:28

接近警报使用长变量来表示过期。您是否将数字-1 放入proximityAlert 中,或者将其声明为等于-1 的变量?也许使用 long 变量而不是 -1 可以修复它。

addProximityAlert(双纬度,双经度,浮动半径,长过期,PendingIntent意图)

The proximity alert uses a long variable for expiration. Are you putting the number -1 in the proximityAlert or a variable declared as long that equals -1? Maybe using a long variable instead of -1 will fix it.

addProximityAlert(double latitude, double longitude, float radius, long expiration, PendingIntent intent)

草莓酥 2024-09-08 01:05:28

LocationManager 使用 HashMap 来存储其警报。
请参阅代码 此处

1) ProximityAlert 使用您提供的 PendingIntent 作为密钥
如果您为 2 个坐标添加 2 个 ProximityAlert,但具有相同的 PendingIntent,则只有最后一个 Proximity 警报才会起作用。

2) 必须使用 removeProximityAlert(PendingIntent pIntent) 来删除警报。

LocationManager uses a HashMap<PendingIntent,ProximityAlert> to store their Alerts.
See code here.

1) ProximityAlert uses your provided PendingIntent as key
if you add 2 ProximityAlert for 2 coordinates but with same PendingIntent then only the last Proximity alert will works.

2) removeProximityAlert(PendingIntent pIntent) has to be used to remove the Alerting.

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