Geolocation on HTC Desire
I'm having some issues using geolocation on the HTC Desire.
It seems to access the GPS device (the icon flashes on top of the screen), however it posts the same location as if i am only using GSM network location which is several 100 meters away from where i stand. The map will display my location fine when i press "view map", however this location is not the one inserted into the post.
Another issue i have is if i save a draft and "update" the location before i save the draft again and finally upload the post, it will not insert a geolocation in the at all.
Any hints for me or are these known problems? :)
It seems to grab the fine location OK for me... any one else having this issue?
Do you have GPS enabled in your settings?
Yes, GPS is enabled.
I can see the GPS device being accessed by the little icon on the top of the screen, however it doesn't seem to get a fix, and the gps icon is only there for a couple of seconds. (i'm standing outside of the apartment when testing ;)
When i press "View map", i get the correct location, but it takes a few seconds for it to update. (it seems to get the coarse location first from the viewMap OnClickListener).
I'm trying to figure out what is going on with eclipse and usb debugging now, but i can't get the unit outside when doing this. However i managed to print some debug info and lm.getBestProvider seems to return "gps". The problem seems to be that it doesn't "listen" to the gps long enough to get a fine location..
I'm testing some more, will report if i figure it out :)
Ok this is really odd..
I wrote a small test program that displays lm.getBestProvider() to a TextView and it returns "network" no matter what i do. If i set a listener in this way:
provider = LocationManager.GPS_PROVIDER; lm.requestLocationUpdates(provider, 10000, 0, this);
It will use my gps and i get the updates just fine.
So now i have rebuilt the svn of wordpress with the following change:
// provider = lm.getBestProvider(criteria, true); provider = LocationManager.GPS_PROVIDER;
And it grabs the fine location correctly :)
Maybe you can add a "force gps use" option?
This patch fixes it for me when i select the force gps option:
As you can see from the page:
The top post is with the option enabled (and it is the correct location).
The post below it is without the option enabled (and it shows an incorrect location) :)
The patch is probably ugly and bumps the database version to 7.
Also i have only put the option into the english strings.xml and regular layout so it will probably break on other languages and on phones using layout-hdpi and layout-small.
My primary programming language is C++ so i do not guarantee it is bug free ;)
I just tried on a nexus one and it worked fine - are you giving it some time to grab the location from the GPS? I posted from the middle of nowhere in Montana and it nailed the location...
Could be a device difference, or something we missed in the code. It could be that we need to listen longer for the GPS signal in certain locations. Thanks for the research!
I think it is a bug in android actually..
getBestProvider() returns "network" unless i remove that option from settings and only have the gps enabled.
All the patch does is force the provider string to "gps" when the check box is enabled, so the time is not the issue.
Do you have both providers enabled in your config or only gps?
I have both enabled in my settings... weird. Perhaps it was fixed in 2.2 which my device is running? I'll try on a droid with 2.1 to see what happens.
This topic has been closed to new replies.