android - 如何获得精确到 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());`
解决方案
推荐阅读
- mysql - MySQL循环通过变量
- mysql - mysql/aurora 没有立即看到已提交事务的结果
- ios - 如何在 Swift 5 中从 UITableView 单击按钮时获取索引路径
- python - 在适用于字符串集的 pydantic 模型中使用正则表达式
- python - 数字格式在 xlsxwriter 中无法正常工作
- excel - 检查 Excel 文件的文化以解析 .Net 中的十进制数字
- python - flask_sqlalchemy 与 Oracle
- mips - 尝试在 0x00400028 处执行非指令。Qtspim 中的错误代码
- python-3.x - 如何编辑我的代码以循环浏览页面?
- php - 如何使用不同的 ID 连接两个表但相关