Android最准确的Location API [英] Android's most accurate Location API

查看:178
本文介绍了Android最准确的Location API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了正常工作,我的应用程序需要一个位置API. 我打算使用Mapbox平台自定义其设计(因为Google Maps 就我而言,没有提供这种级别的自定义).

In order to work, my app requires a location API. I intend use the Mapbox platform to customize its design (since Google Maps does not provide this level of customization, as far as I am concerned).

文档说,我们应该在建立位置信息时使用Google Play API 应用:

Documentation says that we should use Google Play API when building location apps:

与Android相比,首选Google Play服务位置API 框架位置API(android.location)作为一种添加方式 您的应用的位置感知.如果您当前正在使用Android 框架位置API,强烈建议您切换到 尽快使用Google Play服务位置API.

The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible.

我的问题是: 就GPS精度而言,Google Play API是最高效的API吗? 还是应该使用LocationManager和LocationListener做到这一点?

My question is: Is Google Play API the most efficient API when it comes to GPS accuracy? Or should I use the LocationManager and LocationListener way of doing it?

我需要准确性.我应该使用哪一个? 谢谢.

I need accuracy. Which one should I use? Thanks.

推荐答案

在android中也有三种类型的位置:

In android also there are three types of location :

  1. GPS_PROVIDER
  2. NETWORK_PROVIDER
  3. PASSIVE_PROVIDER

因此,根据我的编码经验,我知道如果您使用:

So, as per my coding experience I came to know that if you use :

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10, new MyLocationListener());

您将获得精度高达14位以上的小数位.

you will get precision upto 14+ decimal places.

但是,如果您像这样使用它们的融合:

But if you use fusion of them like this :

LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, my_google_listener);

您将获得高达6到7个小数位的精度.试试吧 !!! 参考

you will get precision upto 6 to 7 decimal places. try it !!! reference

但是请注意,GPS Provider需要花费一些时间来获取位置,而Google定位要快得多,因为它可以将API调用中的数据获取到其Google服务器数据库中.

But note few things here that, GPS Provider takes time to fetch location while Google Location is much faster as it gets data from API call to its google server database.

GPS脱机工作,而Google提供者通过移动或wifi数据获取位置.

GPS works offline while google provider gets the location via mobile or wifi data.

这篇关于Android最准确的Location API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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