获取当前位置没有互联网 - 为Android的PhoneGap地理位置API [英] get current location without internet - phonegap geolocation api for android

查看:141
本文介绍了获取当前位置没有互联网 - 为Android的PhoneGap地理位置API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PhoneGap的地理位置API,它说,以获得用户的当前位置的位置信息的常见来源包括全球定位系统(GPS)和网络信号如IP地址,RFID,WiFi和蓝牙MAC地址推断出的位置和GSM / CDMA的小区ID。我能够得到正确的位置时,互联网为ON(不论GPS的状态)。
有没有一种方法使用三角测量时,互联网是关闭或无法访问得到的位置? (GPS可能是ON或OFF)

I am trying to get the user's current location using phonegap Geolocation api, which says "Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs". I am able to properly get the location when internet is ON (irrespective of the state of GPS). Is there a way to get the location using triangulation when the internet is OFF or not accessible? (GPS might be ON or OFF)

推荐答案

一个大的NO!这就好比削减手,问我能不能拍,现在? GPS和网络位置提供商接收用户设备位置的唯一途径。

A BIG "NO"! This is like cutting down hands and asking if I could clap now? GPS and NETWORK location providers are the only way to receive user device location.

对于 GPS 的位置 - 你需要GPS传感器为ON

For GPS location - you need GPS sensors to be ON.

,并在网络的位置您需要有互联网连接,因为在这种情况下,手机信号塔/ WIFI-点ID的基础上计算出的位置,这然后被发送到Google服务器(通过互联网)来获取相应的手机信号塔或WiFi点的位置的详细信息。谷歌的位置服务器都有自己的位置近似算法,其中它会告诉你的位置的基础上。

And for NETWORK location you need to have internet connection ON, because in this case the location is calculated on the basis of Cell-Tower/Wifi-spot ID which is then sent to google servers (via internet) to fetch the location details of the respective Cell Tower or wifi spot. Google's location server have its own location approximation algorithms on the basis of which it tells your location.

所以,有可能是没有办法,你能接受当两个GPS和互联网OFF位置。

So, there could be no way you could receive a location when both GPS and INTERNET are OFF.

注意:您可以通过使用仍然可以从这些供应商的最后一个接收到的位置的LocationManager 的<一个href=\"http://developer.android.com/reference/android/location/LocationManager.html#getLastKnownLocation%28java.lang.String%29\"><$c$c>getLastKnownLocation()即使在商都关闭。但这个位置通常是过时的,而且任何使用撑不住了。

Note: You can still get the last received location from any of these providers by using LocationManager's getLastKnownLocation() even when the providers are OFF. But this locations are usually outdated ones and are barely of any use.

这篇关于获取当前位置没有互联网 - 为Android的PhoneGap地理位置API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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