Actual GPS on the G1

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Actual GPS on the G1

Postby GregDallas » Tue Oct 21, 2008 3:50 pm

Hi All,

New to the forum and Android programming. Been playing with it for a month or so now and it's really great. I got my G1 in yesterday (2 days before it was supposed to arrive, woohoo!) and, of course, decided to try my app out on it.

I am doing some things with current location tracking and had it all working great in the emulator based on code I found here and elsewhere by using the 'gps' location provider.

However, on the real G1, the app seems to continue to use a mock location provider. I created an activity to just view the providers that are available via LocationManager.getProviders and I see two entries:

1. 'network' with a class of android.location.DummyLocationProvider
2. 'gps' with a class of android.location.DummyLocationProvider

I also noticed when I installed my app it had a double list of permissions. The first part says

Allow this application to:
Network communication - full Internet access
Your location - coarse (network-based) location, fine (GPS) location

Then under that an expandable list that when expanded says:
Your location - mock location sources for testing

I believe the mock part shows because I do have ACCESS_MOCK_LOCATION permission in my manifest.

In any case, when I run the app on the phone and do my GPS stuff it is definitely using some type of dummy position generator. It appears to be somewhat random positions near my location (about 10 miles away).

I cannot figure out and haven't found anything here or by googling that shows the proper way to interrogate the provider system to find the right provider. One thing I've noticed on the actual phone is that when I fire up Google Maps, a little satellite dish icon shows in the status bar as if Maps is turning on and firing up the real GPS provider. When Maps closes, it disappears.

This is a bit long-winded but my basic question is: What needs to change in code that is obtaining a locationprovider to get the real GPS provider and start/stop it as necessary for use within the app?

Thanks!

Greg
GregDallas
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 10, 2008 4:08 am
Location: Dallas, TX

Top

Figured out the problem

Postby GregDallas » Fri Oct 31, 2008 10:16 pm

In case anybody is curious. It turned out to be a dumb mistake. I thought I was obtaining the "gps" provider by name, but due to a bad 'if' condition I was actually triggering a different section that was loading provider 0 by position. On the emulator it worked fine because there is only one provider.

On the actual G1, position 0 is the "network" provider. No idea what locations it was providing on update but I'm guessing maybe nearest tower or something as each update would cause the map to jump several miles.

Silly coding problem, but took me a while to figure it out because I wasn't paying attention ;-)

Greg
GregDallas
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 10, 2008 4:08 am
Location: Dallas, TX

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests