简体   繁体   English

Android Geofence触发延迟/失败

[英]Android Geofence Trigger Delay/Failure

I've registered Geofences in my Android App for 5-6 locations. 我已经在我的Android应用中为5-6个位置注册了地理围栏。

The Geofence event I want, is Geofence Dwell with loitering delay of 10 sec. 我想要的Geofence事件是Geofence Dwell,游荡延迟为10秒。

But using this, the event is sometimes triggered in some Android devices, and doesn't trigger at all in others. 但是使用此功能,有时会在某些Android设备上触发该事件,而在其他设备上根本不会触发该事件。

So, just for testing purpose, I considered below listed scenarios: 因此,仅出于测试目的,我考虑了以下列出的方案:

1) I reduced the loitering delay to 3 sec. 1)我将游荡延迟减少到3秒。 This time results were better, it triggered in 4 out of 5 devices. 这次的结果更好,它触发了五分之四的设备。

2) Another testing scenario was, I registered Geofence Enter event (which obviously has no loitering delay), and this time it triggered in all the devices. 2)另一个测试场景是,我注册了Geofence Enter事件(显然没有延迟),这次是在所有设备中触发的。

Ideally, I need the Geofence Dwell event to be triggered with delay of 10 sec, because I don't to entertain frequent Geofence notifications on Enter event. 理想情况下,我需要在延迟10秒的情况下触发Geofence驻留事件,因为我不会在Enter事件上频繁接收Geofence通知。

Please suggest what could be possibly wrong with Geofence Dwell with longer delays. 请提出延迟较长的Geofence Dwell可能出了什么问题。 Any help would be appreciated. 任何帮助,将不胜感激。

Thanks in advance. 提前致谢。

Typical Reasons for dwell trigger delays: 驻留触发延迟的典型原因:

  1. Location Adapter should be on and set to High Accuracy mode (from System settings) 位置适配器应打开并设置为“高精度”模式(通过系统设置)
  2. For dwell to occur, the mobile phone should be in transit ie moving (if it's connected to charging, or usb, android recognises it as not moving and delays the location calculations ) 为了使驻留发生,移动电话应处于运输中(即正在移动)(如果连接到充电或USB,则android会识别为不移动并延迟位置计算)
  3. Battery optimisation should be off (Triggers will be dealyed if it's on). 电池优化应该关闭(如果打开,触发器将被处理)。
  4. Try manually triggering Google Maps, or Ola/Uber, etc apps which force the device to get accurate location update. 尝试手动触发Google Maps或Ola / Uber等应用,以强制设备获取准确的位置更新。 If such apps are in foreground, triggers are faster and more accurate. 如果此类应用程序处于前台,则触发器将更快,更准确。

If you requirement, is as small as a difference of mere 10 seconds of dwell, you might as well run your own timer logic on a background thread; 如果您需要的时间只有10秒的停留时间,那么您最好在后台线程上运行自己的计时器逻辑。 since in the real world, how much distance in meters (which you specify as the geofence radius) is the device going to really travel in 10 sec ? 因为在现实世界中,该设备将在10秒钟内真正行驶多少米(您指定为地理围栏半径)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM