首页 > 解决方案 > 如何获得精确到 6 米的位置?

问题描述

我一直在使用FusedLocationProviderClient在android中获取位置。问题是它给了我一个不准确的位置(精度范围为 25-50)事件,尽管我已将它设置为PRIORITY_HIGH_ACCURACY. 准确率接近6需要很长时间。

    locationRequest=LocationRequest.create();        
    locationRequest.setInterval(100);
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    //Some other function
    locationCallback=new LocationCallback(){
        @Override
            public void onLocationResult(LocationResult locationResult){
                for(Location location:locationResult.getLocations()){
                    longitude=location.getLongitude();
                    latitude=location.getLatitude();
                    TextView txt_accuracy=(TextView)findViewById(R.id.txt_accuracy);
                    txt_accuracy.setText("Accuracy:"+String.valueOf(location.getAccuracy()));
                    if(location.getAccuracy()<=6){
                        getZone();
                        fusedLocationProviderClient.removeLocationUpdates(locationCallback);
                    }
                }
            }
        };
        fusedLocationProviderClient=LocationServices.getFusedLocationProviderClient(this);
        fusedLocationProviderClient.requestLocationUpdates(locationRequest,locationCallback,
Looper.getMainLooper());`

标签: androidlocation

解决方案


推荐阅读