简体   繁体   中英

Bad location accuracy with Google Maps API in Android

I have an app that uses a MapsActivity, the problem that I'm having is that when I got the realese key from the Android Developer site, the accuracy got a lot worse than with the debug key. When I was using the debug key, its accuracy was almost 100% good. Now my realese app with the realese key shows the location with a minimal error of 15 meters. Moreover, a friend of mine who used the app, told me that it actually showed his location 15 km far from his current position.

Is there any way to improve the Google Maps API's accuracy? Or is there any getLocation method improving it?

Thanks

You can set the accuracy of the locationClient, using the locationRequest. Eg

  mLocationRequest = LocationRequest.create();
  mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
  mLocationClient.requestLocationUpdates(mLocationRequest, (LocationListener) this);

You can also set the frequency of updates. If you need something highly precise, take a bunch of readings over a few seconds. Then look at the "accuracy" number on each reading. Toss out any readings whose accuracy is significantly less accurate than the others. Then average the rest

If you use lower accuracy, it's going to average gps data with wifi and cellular results. GPS consumes more battery, so it uses it less often on this setting. Wifi uses a physical address lookup, since its always moving me towards the public road near my house, even when I'm in the middle of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM