Droid X Cannot Find Position With The MyLocationOverlay Class
September 02, 2010
I have not done very much android programming, but I am getting the hang of things now. But there was one issue that came up during my most recent project where I was unable to get the MyLocationOverlay to work. It either crashed my app, didn’t find my location, or did this constant GPS lookup where I had to actually kill the app to stop it from accessing the GPS and killing my battery. I spent many hours trying to figure it out and pushed it to the end of the task list to figure out later.
When I returned to the issue, I found an article by Dimitar Darazhanski which perfectly described the issue that I was up against. As it turns out, when Motorola implemented their version of android (rant: come on people, just leave the stock OS alone), they didn’t implement the MyLocationOverlay class properly. There are reports of this having been fixed in the last update but definitely is not on my phone. This issue has also been reported to come up on a couple other Motorola phones.
To fix the issue, you can override the MyLocationOverlay class. You can find a copy of such an implementation here. When I downloaded it I had to modify a few things like image references, but it worked great. My application is now running perfectly on my Droid X.