Android位置NETWORK_PROVIDER&& FusedLocation提供不确定的位置

时间:2014-08-29 06:18:27

标签: android android-location

我正在使用NETWORK_PROVIDER& FusedLocation(没有GPS)它不断获得位置但是当我在路上从一个位置导航到另一个位置它给了一些时间以前的位置,因为你可以在图像下方的图像中检查我移动到底部到顶部然后位置1,2,3,4,5,6是完美的,但第7 位置是先前的,然后8,9是完美的位置,但 10th 再次是前一个且不确定11,12 ,13再次走上正轨,但第14次再次出现并且不确定。

enter image description here

我使用下面的代码获取位置&我有更改的准确性也准确度高不会给我位置直到4-5小时4-5小时singel位置它的生活

public void start(){

    int resp =GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
    if(resp == ConnectionResult.SUCCESS){
        locationClient = new LocationClient(mContext, this, this);
        locationClient.connect();
    }
    else{
        Toast.makeText(mContext, "Google Play Service Not Available " + resp, Toast.LENGTH_LONG).show();
    } 
    intent = new Intent(StaticData.BROADCAST_ACTION);
    filter = new IntentFilter(StaticData.BROADCAST_ACTION);
    receiver = new ResponseReceiver();
    mContext.registerReceiver(receiver, filter);
}

@SuppressWarnings({
        "static-access", "unused"
})
@Override
public void onConnected(Bundle bundle) {
    try {
        locationRequest = LocationRequest.create();
        locationRequest = new LocationRequest();
        locationRequest.setSmallestDisplacement(1);
        locationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
        locationRequest.setInterval(1000*60);
        locationRequest.setFastestInterval(1000*60);
        locationManager = (LocationManager)mContext.getSystemService(mContext.LOCATION_SERVICE);
    } catch (Exception e1) {

    }

    try{
        Criteria crit = new Criteria();
        crit.setAccuracy(Criteria.ACCURACY_MEDIUM);
        crit.setPowerRequirement(Criteria.POWER_MEDIUM);
        crit.setAltitudeRequired(false);
        crit.setBearingRequired(false);
        crit.setCostAllowed(true);
        String provider = locationManager.getBestProvider(crit, true);
        locationClient.setMockMode(true);
    }catch (RuntimeException e) {
        AppLog.errorLog(TAG, e);
    }catch (Exception e) {
        AppLog.errorLog(TAG, e);
    }

    try {
        locationClient. requestLocationUpdates(locationRequest, this);
        locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, (1000*60), 10f, this);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        AppLog.errorLog(TAG, e);
    }
}

现在的问题是如何克服这种情况?

1 个答案:

答案 0 :(得分:0)

据我所知,依靠网络进行地理定位真的不确定。我建议您使用GPS精确定位地理定位。