Search code examples
androidgoogle-mapslocation-client

Android Location Client not as Accurate as Google Maps App


I want to preface this by saying that I'm in China where Google location services sometimes have issues.

I'm using the LocationClient to get user's current location.

protected void onCreate(Bundle savedInstanceState) {
  ...
  mLocationClient = new LocationClient(this, this, this);
  ...
}

Very straightforward. Then in my onConnected callback, I get the location.

public void onConnected(Bundle connectionHint) {
  Location location = mLocationClient.getLastLocation();
  ...
}

The location I get back is always the same, but it is about ~500m away from my actual location. GPS is enabled, although the icon indicating it is being used does not come on. I am also on WiFi and have 3G.

When I open the actual Google Maps app, my location is perfectly accurate (unlike the location I get in my own app). I also see the icon indicating GPS is being used.

Questions

  1. What is the Google Map app doing differently to get a more accurate location and how do I do what they do?
  2. If the wrong location I get back is always the same what does that mean? Without overthinking too much, it is a truth of China that foreign map data companies have coordinates the are skewed off by a factor and they have to use a specific algorithm to correct for that difference; is the Google Maps app doing that?

Thanks!


Solution

  • China has a special dealing with GPS data, because the government force the related map producing company to add some bias. I'm stuck with it for a period of time.