cordova中的navigator.geolocation.getCurrentPosition仅提供10米的精度 [英] navigator.geolocation.getCurrentPosition in cordova gives only 10 meter accuracy

查看:208
本文介绍了cordova中的navigator.geolocation.getCurrentPosition仅提供10米的精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

navigator.geolocation.getCurrentPosition 可提供最高10米的精度。我没有使用任何插件进行地理定位。但是其他一些应用程序在同一个地方显示3米精度。

navigator.geolocation.getCurrentPosition in cordova/android gives max 10 meter accuracy. I didn't use any plugin for geolocation. But some other apps shows 3 meter accuracy for the same place.

navigator.geolocation.getCurrentPosition 不能提供更好的准确度?

navigator.geolocation.getCurrentPosition won't give better accuracy?

推荐答案

令人遗憾的是,Android的 cordova-plugin-geolocation 不提供任何本机代码,只需要最少的代码处理Android 6+的权限。
为了获得它使用地理定位的WebView实现的位置,所以如果使用 enableHighAccuracy:true 你没有得到你期望的准确性,你什么都没有做到这一点(可能会向谷歌投诉,以便他们在未来的System WebView更新中对其进行改进)
结果可能会因供应商/ Android版本而异。

Sadly the cordova-plugin-geolocation for Android doesn't provide any native code, just have the minimal code to handle the permissions for Android 6+. For getting the location it uses the WebView implementation of geolocation, so if using enableHighAccuracy: true you don't get the accuracy you expect, there is nothing you can do about it (maybe complain to Google so they improve it in future System WebView updates) The results will probably vary from vendors/Android versions.

所以如果您需要更高的准确性,您应该搜索使用本机代码获取位置的其他插件,而不是使用WebView提供的插件。其中有一些,更好地搜索背景地理定位,因为提供背景地理定位的人使用本机代码。

So if you need better accuracy you should search for a different plugin that uses native code for getting the location instead of using the one that the WebView provides. There are a few of them, better search for "background geolocation", as the ones providing background geolocation use native code.

这篇关于cordova中的navigator.geolocation.getCurrentPosition仅提供10米的精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆