Cool. It seems like the best thing is to do both. Call getLastKnownLocation AND register a listener. LastKnownLocation can be null as documented so you have to expect that. And it can be completely wrong if the the phone has been moved (you get off an airplane and turn on your phone). But you might not get any value for a while from the listener (also as documented) so you have to expect that also. Quote from docs -
"It may take a while to receive the most recent location. If an immediate location is required, applications may use the getLastKnownLocation(String) method." You are right about telnet. I meant I'm running geo fix ON the emulator after invoking telnet and the emulator itself is running Linux - so that's where geo fix runs in telnet (ALWAYS on Linux) even if the O/S is windows or whatever. On Oct 23, 3:50 pm, Brian Conrad <[email protected]> wrote: > I solved the problem and have it working but not the way it originally > worked. Originally in one's code you code set up the location manager > and then call from it getLastKnownLocation and get the coordinates. > These were what examples did when I first looked at GPS code. That was > what got broken and was apparently unintentional. Instead I set up a > location listener and now geo fix works and probably DDMS though I > haven't tried that. My thinking is that most people were writing > applications where they would want updates while running. Mine was just > simple and needed the location at runtime or whenever the user wanted a > recalculation. So I'll instead set up the listener though we still > only care when the application runs or is recalculated. That change is > easy to implement. > > FYI, telnet also runs in the command line on Windows. It's not unique > to Linux. > > jotobjects wrote: > > I just used Google Maps to "prove" that geo fix worked and resulted in > > the platform correctly knowing the location given by geo fix. You > > might want to try that too to prove that geo fix does or doesn't work > > in an application other than your own code. That would be interesting > > confirmation for you and is easy to do. > > > When I telnet into the emulator console and run geo fix as shown I am > > using Linux on the emulator of course. > > > What problem has Android acknowledged regarding geo fix? What is the > > bug number? > > > On Oct 23, 12:44 pm, Brian Conrad <[email protected]> wrote: > > >> Are you running on Windows or Linux? I'm running Ubuntu 8.04 and > >> Eclipse. Android acknowledged geo fix was broken in the 1.5 SDK. I am > >> using geo fix to get the longitude and latitude only and not with Google > >> Maps. Everything is set in the manifest correctly too. I have a 20% > >> installed base which is about 600 users so I doubt if they would keep it > >> around if it wasn't working. > > >> I don't know anything about a rounding bug as I round anyway for use > >> down to degrees and minutes. One would think that DDMS would work when > >> I have the app recalculate after sending coordinates manually. > > >> jotobjects wrote: > > >>> geo fix works for me with both DDMS and the emulator console. Using > >>> console this works - > > >>> telenet localhost 5554 > >>> geo fix -117.24 32.883 > > >>> This locates you in the University of California San Diego campus. I > >>> tried this with DDMS manual geo fix and it works there also. My test > >>> is using Google Maps "My Location" menu selection. What is not > >>> working with geo fix for you? > > >>> Incidently I am now noticing that DDMS gives me the correct location. > >>> But the geo fix command in the console exhibits the rounding problem > >>> Auguste Lunang pointed to that is a couple of hundred feet off (which > >>> is a problem for testing that depends on more accuracy). Do you know > >>> if there is a bug filed for the rounding problem? > > >>> On Oct 22, 5:06 pm, Brian Conrad <[email protected]> wrote: > > >>>> There is a bug filed for geo fix (not by me but by people who found it > >>>> earlier). I haven't filed one for DDMS until I'm sure I grok how it > >>>> works as information still is very sketchy about this stuff and docs > >>>> rather terse. > > >>>> My app calls getLastKnownLocation when it runs once. It will call it > >>>> again if the user selects Recalc. Now under 1.1 when first run the > >>>> emulator it would return what was set with geo fix or a default which I > >>>> believe was Google's coordinates. The DDMS method seems is something > >>>> one would use to emulate location updates. With 1.5 and 1.6 when my > >>>> app runs it gets a null back from getLastKnownLocation on the > >>>> emulator. So then I have DDMS send the coordinates to the emulator (as > >>>> instructed via the Dev Guide) then select Recalc I would think it would > >>>> have the new coordinates but it doesn't and just uses some fixed > >>>> coordinates for demo purposes. Apparently this app is working normally > >>>> on phones I would just like to have it working on the emulator so I > >>>> could add and test similar functionality in other apps. > > >>>> jotobjects wrote: > > >>>>> Has there been a bug filed? > > >>>>> On Oct 22, 2:11 pm, Brian Conrad <[email protected]> wrote: > > >>>>>> Thanks. Yes, I know it's been a known issue because I've inquired a > >>>>>> number of times after each update if it's been fixed. The link you > >>>>>> posted goes back to 2008 but it was working fine in 1.1 last spring. > >>>>>> It's not working with DDMS either. I'll play around with it some more > >>>>>> to try to figure out why it is not working. > > >>>>>> Brian > > >>>>>> Auguste Lunang wrote: > > >>>>>>> Hi,This is a know issue. One of the discussions you can find here: > >>>>>>>http://groups.google.com/group/android-beginners/browse_thread/thread... > >>>>>>> . > >>>>>>> Try to use DDMS to fix your GPS coordinates. > > >>>>>>> Hope it helps.. > >>>>>>> Auguste > > >>>>>>> 2009/10/22 Brian Conrad <[email protected]> > > >>>>>>>> I've tried the geo fix command to set coordinates for a program I > >>>>>>>> wrote > >>>>>>>> that provides the GPS coordinates. This program worked fine in 1.1. > >>>>>>>> But the geo fix command got broken in 1.5 and appears to still have > >>>>>>>> not > >>>>>>>> been fixed in 1.6? When will it be fixed? > > >>>>>>>> Brian Conrad > >>>>>>>> JyotishTools.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

