简体   繁体   中英

Android - My Location appears out of street using Google Maps

I'm developing an app that tracks my location in real time, using FusedLocation API and Google Maps. I use a marker to show my current location.

My problem is that my location is always out of street, following parallel to the street while I move.

It does not seem an inaccuracy of GPS, but a discrepancy between the map and the location.

How can I fix this behavior?

Any help would be appreciated!

Try to use ACCESS_FINE_LOCATION instead of ACCESS_COARSE_LOCATION in the Android manifest permissions

https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION

Well gps data are not precise as they have a margin of error that allows them to be off the road. A solution to that is to snap the collected positions to the roads that are known to the api.

Here 'sa link to the docs that shows how to do that using the java api.

Note: For additional info, the page also gives an example for raw gps location and snapped locations superposed in an image right after the example code.

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