开发者

MyLocationOverlay vs. LocationManager, and background Service

I am developing an app. in which I share my location with friends (very much like google latitude). I have a service which is running as daemon: it should display received locations, and publish current user location each x seconds.

Now, being quite new to Android and Maps, I am a bit confused about MyLocationOverlay and LocationManager.

While experi开发者_如何学Cmenting with the MapActivity, I am using MyLocationOverlay which seems very handy to display my location. Problem is, I am not sure where it is taking the location from (net, gps,.. ?) and how often it updates it. Moreover, I suppose I cannot use it outside the MapActivity, hence I'll need to use the LocationManager anyway.

The question is: using the LocationManager to do the background work and MyLocationOverlay to only show my location would be too much? I suppose it would be better to only use the LocationManager, right?


Using MyLocationOverlay in conjunction with LocationManager is very common. MyLocationOverlay determines location from GPS, then Wifi. You can specify the networks to use for location determination both for MyLocationOverlay and with a LocationManager.

The location is stored for both types of location finding (in other words, if you have a MyLocationOverlay as well as LocationManager, it's not going to poll the GPS twice as hard, its simply going to use the last-received location for both). The last location received by GPS or wifi is stored globally to any application that determines a location.

So to answer your question, no, using a LocationManager as well as a MyLocationOverlay is not too much.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜