安卓:LocationManager.addProximityAlert()及区别; LocationClient.addGeofences() [英] Android : Difference between LocationManager.addProximityAlert() & LocationClient.addGeofences()

查看:1147
本文介绍了安卓:LocationManager.addProximityAlert()及区别; LocationClient.addGeofences()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两种充当一种机制,一旦用户输入/退出一个特定兴趣点来通知。各有什么利弊?

Both of these serve as a mechanism to notify once the user enters/exits a given point of interest. What are the pros and cons of each ?

推荐答案

即将从别人谁切换到谷歌播放服务前一阵子,我可以给你一些经验:

Coming from someone who switched over to Google Play Services a while ago, i can give you some experiences:

我有一个应用程序,大约2,5岁,使用定位服务广泛。当然,从一开始,我们使用了LocationManager因为那是可用的Andr​​oid平台上。

I have an app, about 2,5 years old, that uses location services extensively. From the outset, of course, we used the LocationManager since that's what was available on the Android platform.

我们有一个pretty的不愉快的经历与位置服务在Android相比,IOS。这是越野车,不可靠的,并给了比我们比iOS应用较少precise的位置,再加上它倒掉更多的电池。这是一个拖累。

We had a pretty bad experience with Location Services on Android compared to IOS. It was buggy, unreliable, and gave less precise locations than than our IOS app, plus that it drained more battery. It was a drag.

为此,当谷歌推出在六月新的API今年夏天,我们抓住了它。这是更好的方式。几件事情:

Therefor, when Google unveiled the new API in june this summer, we jumped at it. It is way better. A couple of things:

  1. 这是更快,更可靠。
  2. 这是bug更少。作为一个例子,在旧的API,我们可以有时会用新的时间戳旧的修复。这永远不会发生了。还有更精彩的,但是这将是一个更加漫长的职务。
  3. 这肯定水渠较少的电池。例如,当你有一个地图视图中打开时,GPS运行所有的时间,和GPS图标是可见的。这是不使用新的一种的情况下。这使得用户不知道发生了什么事情。这是nolonger大问题。

所以,当它涉及到的位置输出和工作,事情就会变得更好。但也有一些缺点:

So, when it comes to the location output and work, everything is better. But there are some downsides:

  1. 您必须有谷歌播放已安装的服务,这意味着它不会工作在任何非谷歌批准的手机型号,并在某些情况下,你必须告诉他们需要安装它的用户。

  1. You have to have Google Play Services installed, meaning it wont work on any "non-google-approved" phone models, and in some instances you'll have to tell users they need to install it.

API本身比较复杂国际海事组织,部分原因是由于点1.除正规军的回调,即等待位置定位等您现在有一个过程,需要的部分,你可以开始之前在哪里你必须检查可用playservices,和连接的locationclient。这是额外的code和更复杂一点把握。更多的故障情况,考虑到在code太(如果你可以打扰...)

The API itself is more complex IMO, in part due to point 1. In addition to the "regular" callbacks i.e. waiting for location fixes etc. You now have a process that takes part before you can get started where you have to check that playservices is available, and "connect" the locationclient. This is extra code and a bit more complex to grasp. More faulty conditions to take into account in the code too (if you can be bothered...)

谷歌播放服务本身需要至少2.2所以它不会比旧设备正常工作。我们不得不告诉一些客户,他们不得不升级...

Google play services itself requires at least 2.2 so it won't work for older devices than that. We had to tell some clients they had to upgrade...

希望这有助于。

这篇关于安卓:LocationManager.addProximityAlert()及区别; LocationClient.addGeofences()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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