Android GPS需要上网吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12128990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does GPS require Internet?
提问by Ibad Baig
Is it necessary to turn both Internet
and GPS
on before I can read my current location(country, city, locality etc) in my app? If they are, then any alternative way to get the location only from GPS? Since the internet availability is an issue.
在我的应用程序中读取我当前的位置(国家、城市、地区等)之前,是否需要同时打开Internet
和打开GPS
?如果是,那么仅从 GPS 获取位置的其他方法是什么?由于互联网可用性是一个问题。
回答by psubsee2003
As others have said, you do not need internet for GPS.
正如其他人所说,GPS 不需要互联网。
GPSis basically a satellite based positioning system that is designed to calculate geographic coordinates based on timing information received from multiple satellites in the GPS constellation. GPS has a relatively slow time to first fix (TTFF), and from a cold start (meaning without a last known position), it can take up to 15 minutes to download the data it needs from the satellites to calculate a position. A-GPSused by cellular networks shortens this time by using the cellular network to deliver the satellite data to the phone.
GPS基本上是一种基于卫星的定位系统,旨在根据从 GPS 星座中的多颗卫星接收到的时间信息计算地理坐标。GPS 的首次定位时间 (TTFF) 相对较慢,并且从冷启动(意味着没有最后一个已知位置)开始,从卫星下载计算位置所需的数据可能需要长达 15 分钟。 蜂窝网络使用的A-GPS通过使用蜂窝网络将卫星数据传送到手机来缩短此时间。
But regardless of whether it is an A-GPS or GPS location, all that is derived is Geographic Coordinates (latitude/longitude). It is impossible to obtain more from GPS only.
但无论是 A-GPS 还是 GPS 位置,导出的都是地理坐标(纬度/经度)。仅从 GPS 获取更多信息是不可能的。
To be able to return anything other than coordinates (such as an address), you need some mechanism to do Reverse Geocoding. Typically this is done by querying a server or a web service (like using Google Mapsor Bing Maps, but there are others). Some of the services will allow you to cache data locally, but it would still require an internet connection for periods of time to download the map information in the surrounding area.
为了能够返回坐标以外的任何内容(例如地址),您需要某种机制来执行反向地理编码。通常这是通过查询服务器或网络服务来完成的(比如使用Google Maps或Bing Maps,但还有其他的)。有些服务允许您在本地缓存数据,但仍需要一段时间的互联网连接才能下载周边地区的地图信息。
While it requires a significant amount of effort, you can write your own tool to do the reverse geocoding, but you still need to be able to house the data somewhere as the amount of data required to do this is far more you can store on a phone, which means you still need an internet connection to do it. If you think of tools like Garmin GPS Navigation units, they do store the data locally, so it is possible, but you will need to optimize it for maximum storage and would probably need more than is generally available in a phone.
虽然这需要大量的工作,但您可以编写自己的工具来进行反向地理编码,但您仍然需要能够将数据存放在某处,因为执行此操作所需的数据量远远超过您可以存储在电话,这意味着您仍然需要互联网连接才能执行此操作。如果您想到 Garmin GPS 导航装置之类的工具,它们确实将数据存储在本地,因此这是可能的,但您需要对其进行优化以获得最大存储量,并且可能需要比手机中通常可用的更多。
Bottom line:
底线:
The short answer to your question is, no you do not need an active internet connection to get coordinates, but unless you are building a specialized device or have unlimited storage, you will need an internet connection to turn those coordinates into anything else.
对您的问题的简短回答是,不,您不需要有效的互联网连接来获取坐标,但除非您正在构建专用设备或拥有无限存储空间,否则您将需要互联网连接才能将这些坐标转换为其他任何东西。
回答by Phonix
In Android 4
在安卓 4
Go to Setting->Location services->
进入设置->定位服务->
Uncheck Google`s location service.
Check GPS satelites.
取消选中 Google 的位置服务。
检查 GPS 卫星。
For test you can use GPS Test.Please test Outdoor!
Offline maps are available on new version of Google map.
对于测试,您可以使用GPS 测试。请在户外测试!
离线地图可在新版Google 地图上使用。
回答by Igor F.
There are two issues:
有两个问题:
- Getting the current coordinates (longitude, latitude, perhaps altitude) based on some external signals received by your device, and
- Deriving a human-readable position (address) from the coordinates.
- 根据您的设备接收到的一些外部信号获取当前坐标(经度、纬度,也许是海拔),以及
- 从坐标中导出人类可读的位置(地址)。
To get the coordinates you don't need the Internet. GPS is satellite-based. But to derive street/city information from the coordinates, you'd need either to implement the map and the corresponding algorithms yourself on the device (a lot of work!) or to rely on proven services, e.g. by Google, in which case you'd need an Internet connection.
要获得坐标,您不需要互联网。GPS 是基于卫星的。但是要从坐标中获取街道/城市信息,您需要自己在设备上实现地图和相应的算法(大量工作!)或依赖经过验证的服务,例如谷歌,在这种情况下,您需要互联网连接。
As of recently, Google allows for caching the maps, which would at least allow you to show your current position on the map even without a data connection, provided, you had cached the map in advance, when you could access the Internet.
最近,谷歌允许缓存地图,这至少允许您在没有数据连接的情况下在地图上显示您当前的位置,前提是您已经提前缓存了地图,以便您可以访问互联网。
回答by Aleksandar Stojadinovic
GPS does not need any kind of internet or wireless connection, but there are technologies like A-GPS that use the mobile network to shorten the time to first fix, or the initial positioning or increase the precision in situations when there is a low satellite visibility.
GPS 不需要任何类型的互联网或无线连接,但有一些技术,如 A-GPS,它使用移动网络来缩短首次定位的时间,或在卫星能见度低的情况下进行初始定位或提高精度.
Android phones tend to use A-GPS. If there is no connectivity, they use pure GPS. They do not override the data network mode. If you deactivated it, the phone won't use any data connection (which is handy if you are abroad, and do not want to pay expensive data roaming).
Android 手机倾向于使用 A-GPS。如果没有连接,他们使用纯 GPS。它们不会覆盖数据网络模式。如果您停用它,手机将不会使用任何数据连接(如果您在国外并且不想支付昂贵的数据漫游费用,这将很方便)。
回答by Korcholis
I've found out that GPS does not need Internet, BUT of course if you need to download maps, you will need a data connection or wifi.
我发现 GPS 不需要互联网,但当然,如果您需要下载地图,则需要数据连接或 wifi。
http://androidforums.com/samsung-fascinate/288871-gps-independent-3g-wi-fi.htmlhttp://www.droidforums.net/forum/droid-applications/63145-does-google-navigation-gps-requires-3g-work.html
http://androidforums.com/samsung-fascinate/288871-gps-independent-3g-wi-fi.htmlhttp://www.droidforums.net/forum/droid-applications/63145-does-google-navigation-gps -requires-3g-work.html