本文介绍了我如何使用Android地理围栏API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在测试新的谷歌游戏地理围栏服务API。

我从 Android开发者网站下载示例code。接下来,我跑了那么例如code Android设备(银河注2)。我把我的办公室的地缘位置和半径为10米,但是当我走进我的办公室,什么都没有发生。

在运行样品code,有一件事我注意到的是,当我已经里面的栅栏范围和地理围栏添加到 LocationClient ,没有任何反应。

我读<$c$c>LocationClient类文档,发现以下段落:

于是我打开无线网络,并走到我的办公室(地理​​栅栏内),然后我得到的通知地理围栏进入。

我有以下问题:

  1. 地理围栏是否只带WiFi的工作启用?

  2. 为什么没有我的3G网络的工作提供的位置?

  3. 这是样品code一个错误?

  4. 或者,这是我的错误?

解决方案

如果你只使用蜂窝网络,定位精度较低,比Wi-Fi或GPS(如果你打开​​谷歌地图,蓝色圆圈是精度估计您现在的位置 - 如果你只使用3GP,圆能有甚至几百米的半径)

最后的日子里,我对一个应用程序的工作使用Geofences,我想通了以下内容:恕我直言地理栅栏入口只有当这一切的位置估算圈是地理围栏半径内触发,也就是说,如果有100%的机会,你进入地理栅栏。因此,这取决于你有多大的半径设置。如果设置了只有10米,它可能只与全球定位系统的工作,从不与3GP。对于3GP,你必须设置半径像1000米。

I have been testing the new Google Play Geofencing service API.

I downloaded the sample code from the Android developers site. Next, I ran then example code on an Android device (Galaxy Note 2).I placed my office geo-position and radius to 10m, but when I was walked to my office, nothing happened.

While running the sample code, one thing I have noticed is that when I am already inside the geofence range and add the geofence to LocationClient, nothing happens.

I read LocationClient class documentation, and found the following paragraph:

So I turned on WiFi, and was walking to my office (inside the geofence), and then I got notification "geofence entered".

I have the following questions:

  1. Does geofencing only work with WiFi enabled?

  2. Why doesn't the location provided by my 3G network work?

  3. Is this a bug in the sample code?

  4. Or is this my mistake?

解决方案

If you only use cellular network, the location accuracy is lower, than the accuracy of wi-fi or gps (if you open Google Maps, the blue circle is estimation of your current position - if you only use 3GP, the circle can have radius of even hundreds of meters).

Last days I am working on an app using Geofences and I figured out the following: IMHO the geofence entry is triggered only if ALL this "location estimation circle" is inside the geofence radius, i.e. if there is 100 % chance that you entered the geofence. So it depends on how big radius you set. If you set only 10 metres, it will probably work only with GPS, never with 3GP. For 3GP you will have to set radius like 1000 metres.

这篇关于我如何使用Android地理围栏API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 18:37
查看更多