CG wrote: > I don't really have an issue but I am just wondering what is the best > way to get a simple GPS position (no update required).
I am not certain what you mean by "no update required". > I just want to have the current position when my app is launched > > By reading the documentation it seems really simple and this is what I > am doing : > > locMgr.getLastKnownLocation(locMgr.getBestProvider(new Criteria(), > true)); > > But I wonder if this is the right way of doing. > Almost sometimes I could not get any Location (null returned) I don't > know why, maybe the fix sent by telnet is limited in the time... Depending on the provider you get back from your getBestProvider() call, there may or may not have been any locations recorded. If the provider has not recorded a location, then getLastKnownLocation() will be null. This is why I asked about the "no update required" statement. If you truly mean "no update required", then you will have to accept that this means there may not be a location available (getLastKnownLocation() returns null). If you *must* have a location, then you will need to either always go through the location-updates process, or at least use that when getLastKnownLocation() returns null. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---