FusedLocationApi Performance Issue: Accuracy seems

2019-01-19 08:32发布

I'm experiencing a strange problem where the FusedLocationProviderAPI does not give me a better Accuracy number then 10.0 meters. It starts like normal giving me a high number of, for example, 56 meters... 24... 13... and then stays at 10.0. Seemingly capped at giving no better then that.

Tried on Phone Sony Xperia Z2 & Huawei Honor 8

location.getAccuracy() //Seems capped at 10.0 meters

The strange part is that I was receiving an Accuracy number down to around 3.0 meters with good weather outside and I have no memory of changing the phones GPS options / nor any options related to the GPS Service Class.

My app is dependant on being able to get the highest accuracy number possible. What could be the issue here? The Phone itself? The settings of the request? Possible reasons of the capped number?

Edit: Experienced the same problem when trying on the Huwaei. So there seems to be an issue with the code? Like after x amount of location requests accuracy gets capped at 10.0 from system??

Relevant things from my GPS service:

Manifest

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

Service

private long UPDATE_INTERVAL = 2 * 1000;  /* 10 secs */
private long FASTEST_INTERVAL = 2000; /* 2 sec */
static final int MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 1;

private void requestLocation() {
    locationRequest = new LocationRequest();
    locationRequest.setInterval(UPDATE_INTERVAL);
    locationRequest.setFastestInterval(FASTEST_INTERVAL);
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    gac = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();
}

@Override
public void onLocationChanged(Location location) {

    locationData = location; //1. Set local field to incoming location
    gpsAccuracy = location.getAccuracy(); //2. Est. horizontal accuracy of location, radial, in meters.
}

1条回答
Rolldiameter
2楼-- · 2019-01-19 09:14

It looks like 10 m is the best approx accuracy you can get with FusedLocationServicesApi, with HIGH_ACCURACY as the priority. However, I believe it might be possible to get better accuracy by using LocationManager. Check out this article: http://www.tothenew.com/blog/googles-fused-location-api-for-android/

查看更多
登录 后发表回答