难道Android的Geofences仍然有效,直到删除/到期或只有等到我PendingIntent启动 [英] Do Android Geofences remain active until removed/expired or only until my PendingIntent is launched

查看:312
本文介绍了难道Android的Geofences仍然有效,直到删除/到期或只有等到我PendingIntent启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现的功能与geofences之前我得到任何严肃的工作完成后,我需要知道geofences是否第一次转型后,仍然有效。

I'm about to implement a feature with geofences and before I get any serious work done, I need to know whether geofences remain active after the first transition.

该功能的核心是:

每次我点P x的米之内我(这个的 A区的),我想要的的纠正措施B 的发生。

every time I'm within x meters of point P (call this Area A), I want Action B to occur.

我需要知道的是

  • 请我只需要添加地理栅栏与 Geofence.NEVER_EXPIRE 键,放心,我会得到一个PendingIntent的每次我不管经过时间进入指定区域,重新启动等
  • Do I just have to add a geofence with Geofence.NEVER_EXPIRE and rest assured that I will get a PendingIntent every time I enter the specified area regardless of elapsed time, reboots, etc

  • 请我一定要重新注册该地理栅栏,一旦我离开A区,以便下一次我进入得到通知的 A区的?

我希望是前者的话

推荐答案

好命题是第一位的。如果您创建一个标志NEVER_EXPIRE为到期时间地理栅栏,你将不必重新注册它时,它被触发(通过去或缩小)。我100%肯定这一点,我现在刚完成编码和测试有关的地理栅栏POC。

The good proposition is the first one. If you create a geofence with the flag NEVER_EXPIRE as expiration time, you won't have to re-register it when it is triggered (by going in or out). I'm 100% certain of this, I'm right now just finished coding and testing a POC about geofence.

从文档,对于地理栅栏要删除的唯一方式是要么过期时间达到,或者它是由装置本身中删除。

From the doc, the only way for a geofence to be deleted is either expiration time is reached or it is deleted by the device itself.

过期时间

多久地理栅栏应保持活跃。一旦   过期时间达到时,位置服务删除地理栅栏。   在大多数情况下,你应该指定一个过期时间,但可能   要保持用户的家中或工作地点的永久geofences。

How long the geofence should remain active. Once the expiration time is reached, Location Services deletes the geofence. Most of the time, you should specify an expiration time, but you may want to keep permanent geofences for the user's home or place of work.

要停止地理围栏监控,为您免除geofences自己

To stop geofence monitoring, you remove the geofences themselves

这篇关于难道Android的Geofences仍然有效,直到删除/到期或只有等到我PendingIntent启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆