Android的地理界线:经常不正确退出/进入事件,而设备在围栏实际上固定 [英] Android Geofencing: frequent incorrect EXIT/ENTER events whereas device is actually stationary in fence

查看:198
本文介绍了Android的地理界线:经常不正确退出/进入事件,而设备在围栏实际上固定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作有地理围栏功能的应用程序,使用谷歌的播放服务API

I am working on an app that has geofencing features, using the Google Play Services APIs.

它的工作原理pretty也一般,但我经常收到误报,这意味着我收到退出事件紧接着ENTER事件,即使该设备实际上是地理栅栏里面没有动。

It works pretty well in general, except I frequently receive "false positives", meaning I receive EXIT events quickly followed by ENTER events, even when the device is actually inside the geofence and didn't move.

情况好转了一点,当我开始听详谈事件,而不是ENTER键(用3分钟的时间游荡)。我用100米半径的围栏。

The situation improved a bit when I started listening to DWELL events instead of ENTER (with a loitering time of 3 minutes). I use a radius of 100m for the fences.

但是,这样做的时候,我还是收到了不正确的退出事件。理想我很想有大亨的公子时间相当,但对退出事件(被通知只有当设备已经看到了围栏至少X分钟退出事件的能力)。我认为这将解决问题;不幸的是,API不具备这样的功能。

But when doing this, I still receive the incorrect EXIT events. Ideally I would love to have the equivalent of the loitering time, but for EXIT events (the ability to be notified of EXIT events only if the device has been seen out of the fence at least for x minutes). I think this would solve the problem; unfortunately the API doesn't have such feature.

这是问题的一个常见的​​一种,而且可以做些什么来解决?

Is this problem a common one, and what can be done to resolve it?

推荐答案

determening当前地理位置依赖于手机塔楼,其中你的手机连接到时出现问题。如果你的手机切换细胞塔,这些都​​是远离彼此的谷歌serverice假定你已经感动。

The problem occurs when determening the current geo-location depends on the cell-phone-towers where your cellphone is connected to. if your phone switches the cell-towers and these are far away from each other the google serverice assumes that you have moved.

我已经通过引入时间延迟反应事件发生前解决了类似的问题:

I have solved a similar problem by introducing a time delay before reacting to event:

一个计时器清零(如果已激活),然后开始在事件发生时。

A timer is cleared (if active) and then started if an event occurs.

当定时器事件发生且仅当新的事件状态是从previos事件状态

the eventhandling is done when the timer event occurs and only if the new event state is different from the previos event state

例如:如果你的计时器都有5分钟的延迟的延迟时间下的所有事件的变化将被忽略。如果previos计时器事件是进入新计时器事件是进入什么也不做。

Example: if your timer has a delay of 5 minutes all event changes below the delay time will be ignored. if previos timer event was enter and new timer event is enter do nothing.

这篇关于Android的地理界线:经常不正确退出/进入事件,而设备在围栏实际上固定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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