Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps & apps with mapview have different current positions

I have a mapview where I want to track the user's current location. GPS as well as 'use wireless networks' is activated in my phone settings. Nevertheless, since I'm indoor I don't get a GPS fix, therefore the location is determined via network; wifi spot is available.

I have the Google Maps app running as well as my application running.

Strangely, the current location differes between Google Maps and my application, where the Google Maps is very accurate while in my app the location is somehow off a few 100 meters.

In my application I basically do the following (for debugging purposes now):

1) initially place one marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

2) initially place another marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

This will put the last known locations of both providers onto the map (eventually last known from outside my app).

3) then for the regular updates (since I don't get a GPS fix anyway indoor here), I do:

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, baseLocationListener);

You can see for the frequency and distance I pass the 0 param in both cases.

In the app manifest, the following permissions are granted:

android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_MOCK_LOCATION

Actually my baseLocationListener does get called, which I see in the log, but the updated location is somehow the same as the last known current position (of LocationManager.NETWORK_PROVIDER), same lat/lng.

I thought maybe I overlooked something or missed a parameter or setting, or my code has a bug. Therefore I installed some other (3 in total) LBS apps from the Android market that also show the current user's location. The current locations displayed in those apps are equals to the one in my application - and they're all some 100 meters off - but at least all the same.

See the screenshot here: screenshot http://img33.imageshack.us/img33/8679/mapproblem.png

http://img33.imageshack.us/img33/8679/mapproblem.png

Now I am wondering:

1) as I understand, getLastKnowLocation is system-wide and not app-wide, why are there differences between the location in Google maps and all the other apps?

2) does Google Maps not update the lastKnownLocation of a provider?

3) does Google Maps use a different custom location provider (i.e. due to licensing reasons) other than GPS_PROVIDER or NETWORK_PROVIDER as they are in the SDK?

4) how do achieve the same accurate result with the NETWORK_PROVIDER like Google Maps does?

like image 924
Mathias Conradt Avatar asked Jul 20 '10 10:07

Mathias Conradt


People also ask

Can I use Google Maps for free?

With Google Maps Platform flexible pricing, daily quotas, and 28,500 maploads per month for no charge, it's easy to stay on budget. Sorry, your browser doesn't support embedded videos. That's 28,500 maploads per month for no charge.

Does Google Maps work with Apple Watch?

To get a seamless navigation between your phone and watch, install Google Maps on your Apple Watch. On your watch, you can also navigate to existing shortcuts, get step-by-step directions, and get the current ETA for your commute.


1 Answers

I think I found an answer, although not a solution. It seems that the problem is in the data quality of the different map provider that are used for Google Maps and MapView in SDK, which differ.

The map tiles coordinates don't seem to be very accurate, just like in the public google maps web api / tiles.

See this screenshot for an example, where I pinned the same geo point. screenshot http://img339.imageshack.us/img339/2793/gmaps2.png http://img339.imageshack.us/i/gmaps2.png/

The map using the public map api is off a few hundred meters. Seems that we just have to live with it ?! :(

like image 115
Mathias Conradt Avatar answered Sep 21 '22 08:09

Mathias Conradt