简体   繁体   English

当蜂窝数据和Wi-Fi都关闭时,是否可以获得用户位置?

[英]Is it possible to get user location when both cellular data and wi-fi are turned off?

I was in Scotland with a Canadian phone recently, and to avoid roaming charges I had my cellular data turned off throughout the trip. 我最近在苏格兰用加拿大手机,并且为了避免漫游费用,我在整个行程中关闭了我的手机数据。 However, the pictures I took still had accurate geotags, meaning my location was still available to my camera apps (even though I couldn't actually see these locations on a map until I got home). 然而,我拍摄的照片仍然有准确的地理标记,这意味着我的位置仍然可用于我的相机应用程序(即使我在地图上实际上看不到这些位置,直到我回到家)。

My question is: how would I go about retrieving location data in a situation like that, where I can't actually display a map because there is no internet connection? 我的问题是:如何在这种情况下检索位置数据,我实际上无法显示地图,因为没有互联网连接? And, just to improve my understanding, how is the location actually being retrieved? 并且,为了提高我的理解,如何实际检索位置? If "cellular data" is off, is GPS still available, or can the location only be calculated using nearby wi-fi hotspots at that point? 如果“蜂窝数据”关闭,GPS是否仍然可用,或者该位置是否只能使用附近的Wi-Fi热点进行计算? And finally, if both cellular data AND wi-fi is turned off on a device, can location still be retrieved (ie is GPS still active)? 最后,如果在设备上关闭蜂窝数据和Wi-Fi,仍然可以检索位置(即GPS仍处于活动状态)?

Any info on the subject is welcome - all I am trying to do is handle all possible situations created by the presence or lack of location services and an internet connection in an app where I (if possible) display and store the user's location. 有关该主题的任何信息都是受欢迎的 - 我所要做的就是处理由于存在或缺少位置服务而创建的所有可能情况以及应用程序中的互联网连接,其中我(如果可能)显示并存储用户的位置。

Thanks! 谢谢!

iOS devices that have actual GPS hardware in them can give accurate location data even if there is no WiFi or cellular. 即使没有WiFi或蜂窝网络,具有实际GPS硬件的iOS设备也可以提供准确的位置数据。

Of course, most map apps require an Internet connection to display a map. 当然,大多数地图应用程序都需要Internet连接才能显示地图。 But if you have a map app with local map data, then you would be able to see the map with your position even without any Internet connection. 但是,如果您有一个包含本地地图数据的地图应用程序,那么即使没有任何互联网连接,您也可以看到具有您位置的地图。

On devices with an actual GPS, location services works just fine with no Internet. 在具有实际GPS的设备上,位置服务在没有互联网的情况下工作正常。 It may take a little longer to zero in on your position but it still works normally. 您的位置可能需要更长时间才能归零,但它仍能正常工作。 Of course on iOS devices with no real GPS, you do need a cellular or WiFi signal to get any position data. 当然,在没有真正GPS的iOS设备上,您需要蜂窝或WiFi信号来获取任何位置数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM