更新时间:2022-12-26 19:07:22
要获取准确的位置,您需要考虑两个因素:
There are two factors you need to consider to obtain an accurate location:
代码,例如
The code, eg
设备
这些将在下面讨论.
代码
确保已遵循 Android Developer href ="http://developer.android.com/training/basics/location/locationmanager.html#TaskPickLocationProvider">(感谢比尔·加里)
但是请记住,只有在设备本身具有必需的硬件和配置时,该代码才有效-参见下文.
But remember that the code will work only if the device itself has the requisite HW and configuration - see below.
设备
要了解您的位置修复出了什么问题,真的有助于了解您的设备如何定位自身.位置是通过几种技术获得的:
To understand what is going wrong with your location fix, it really helps to understand how your device locates itself. Location is obtained by several technologies:
GPS芯片组
GPS chipset
在WiFi上可见的MAC(通过查询中间数据库(例如Google的数据库)
MACs visible on WiFi (by querying a central DB such as Google's)
您正在使用的手机天线杆的位置(网络提供商)
The location of the cell-phone mast you are using (Network Provider)
当您要求位置定位(不包括最后一个缓存的位置)时,一个好的GPS定位提供商实际上所关注的不仅仅是GPS:
When you ask for a location fix (excluding the last, cached one), a good GPS location provider actually looks at a lot more than just GPS:
如果启用了GPS芯片组,它将开始GPS跟踪
It starts GPS tracking if the GPS chipset is enabled
如果启用了WiFi,它将开始对Wifi环境进行扫描
It starts a scan of the Wifi environment, if WiFi is enabled
通常,您会在Google Maps上看到这些效果,例如:启动时,您会看到Network Provider的一个很大的大概位置(蜂窝塔),几秒钟后,它会放大一个更大程度的区域精确度(WiFi),最后您可能会获得GPS修复.
Often you can see these effects on Google Maps, for example: when you start it you see a large approximate location (cell tower) from the Network Provider, a few seconds later it zooms in on an area with a greater degree of accuracy (WiFi), and finally you may get a GPS fix.
总是值得的:
编辑
从获得的基本结果来看,您似乎只有网络提供商提供的结果.所以,做:
From the basic results you're getting, you seem to have only results from the Network Provider. So, do: