开发者

GPS Location without service

开发者 https://www.devze.com 2023-01-06 09:39 出处:网络
I am a new developer and have a simple question that I have searched all over for, but have not found a clear answer yet...

I am a new developer and have a simple question that I have searched all over for, but have not found a clear answer yet...

Simply put, I am developing an application that needs to be able to use GPS. The trick is however that I would like to use GPS to get a phone's location even if they have no carrier service.

With that said I have 2 questions.

  1. Is is possible to get the GPS location of a phone with no carrier service with a wifi connection?

  2. Is is possible to get the GPS location of a phone with no ca开发者_StackOverflow中文版rrier service AND no wifi service?

Thanks in advance


  1. Yes, it is on many handsets. The WiFi network may be mapped which will speed up the AGPS chip, or allow offloading of position calculation to the provider.

  2. Varies by the GPS chip in question. In some cases, it will simply not work (the GPS processor requires network communication). In most cases the GPS will take up to 10 minutes to fix from a cold start, as it must receive the current satellite almanac in order to compute position.


While it it true that AGPS is dependent on some kind of data communication most Android phones have true GPS chipsets which means that they communicate with satellites in space regardless of any data connection. This will provide a more accurate position, but will be slower to acquire. Your best bet is to listen for position updates from both Network and GPS providers so that phones with a data connection will get a fast, rough fix that can be refined by the GPS and phones that don't have a data connection will simply not raise an event until the GPS gets a fix. If you want to be extremely robust then don't block waiting on the fix so the user can at least continue to use your app instead of staring at a spinning icon.

0

精彩评论

暂无评论...
验证码 换一张
取 消