开发者

How am I notified if I can't get any gps fix location?

For example, I am inside a building and i want to get my location with the accuracy of 0.75 (Criteria.ACCURACY_FINE) and this will use the gps if my gps is on. Since I am inside a building, gps won't work.

How can I determine if it is really impossible to get a gps fix location?

Is onLocationChanged(Location arg0) will be called even though no gps fix location was received when using Locatio开发者_开发百科nListener?

Is it possible to use a timeout in requesting gps location so that I can shift to network as the location provider if i can't get any location?


I see three basic possibilities:

  1. Setup a LocationListener, and then determine it based upon calls to onStatusChanged. My concern here is that I'm not sure how well android is able to determine the difference between OUT_OF_SERVICE and TEMPORARILY_UNAVAILABLE. I would hope that its based upon signal strength, but its probably something to test.
  2. Simply listen to both. If you haven't heard from the (more accurate) gps provider in a certain period of time, then switch to the less reliable approaches. This may consume more power due to the requirement to monitor multiple location sources simultaneously, but is probably the most reliable method otherwise.
  3. Some hybrid of 1 and 2 above (gps, but switch to local if no results for a while)... this might be the most efficient, but more difficult to implement.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜