The Fused Location API gives inaccurate Lat, Long when building a map on a map a little off the road, even for low accuracy

Google provides a paid provider API to get location coordinates. According to the documentation, the API internally checks location data from different providers (GPS, Wi-Fi, cellular networks) and provides the best location. But in high precision mode, I collected the information below. In this test, GPS is always on.

Latitude: 12.8560136
Longitude: 80.1997696
User Activity: IN VEHICLE
Speed: 21.810165 mph
Altitude: -83.0 
Accuracy: 12.0 

When I see this point on the map, the points are not on the road. They are a bit off the road. Other points are drawn with equal precision on the road. When I click and see , some points are slightly off the road traveled.

I want accurate information. This indicates the path of the road.

I used the Fused Location API to get location information.

mGoogleApiClient = new GoogleApiClient.Builder(mContext)
            .addApi(LocationServices.API).addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).build();

Share your suggestion. If I use Location manager , it will solve my problem. And also I need to consume less battery. The Fused API ensures that it consumes less power and is more efficient.

In addition, the Fused Location API has problems below,

  • Unable to get satellite count.
  • Always returns a FUSED provider. Inaccurately gives which provider (GPS or network) returns location information.
  • Yours is never notified when both providers are unavailable. It does not return any cost if none of the suppliers is available. To check the availability of the provider, we need to register separately in the location manager. which consumes more energy.

, . .

+4
2

.

. , , 12 . 3,7 . 12- 12/3,7 = 3,25 . . , .

GPS_PROVIDER

LatLng

android

Android Maps GPS outlier

Fused Location

. , , - = .

0

GPS . . , API . , Google Maps OSM, :

, , HyperTrack SDK Android, . ( : HyperTrack.)

, , FusedLocationProviderApi . , GpsStatus.Listener. , , GPS. , :

public class GPSStatusListener implements GpsStatus.Listener {

    private LocationManager locationManager;
    private boolean gpsFix;

    public GPSStatusListener(LocationManager locationManager) {
        this.locationManager = locationManager;
    }

    @Override
    public void onGpsStatusChanged(int changeType) {
        if (locationManager != null) {
            try {
                GpsStatus status = locationManager.getGpsStatus(null);

                switch (changeType) {
                    case GpsStatus.GPS_EVENT_FIRST_FIX: // Received first fix
                        gpsFix = true;
                        break;

                    case GpsStatus.GPS_EVENT_SATELLITE_STATUS: // Check if satellites are in fix
                        for (GpsSatellite sat : status.getSatellites()) {
                            if (sat.usedInFix()) {
                                gpsFix = true;
                                break;
                            } else {
                                gpsFix = false;
                            }
                        }

                        break;

                    case GpsStatus.GPS_EVENT_STARTED: // GPS turned on
                        gpsFix = false;
                        break;

                    case GpsStatus.GPS_EVENT_STOPPED: // GPS turned off
                        gpsFix = false;
                        break;

                    default:
                        gpsFix = false;
                        return;
                }
            } catch (Exception e){
                // Handle exception
            }
        }
    }

    public String getProvider() {
        if (gpsFix) {
            return "gps";
        } else {
            return "non_gps";
        }
    }
}
0

Source: https://habr.com/ru/post/1568280/


All Articles