我正在使用一个真实的安卓设备(版本5.1)
我能够使用react-native-maps确定我的位置(正确地在我的应用程序中显示蓝点位置),并且我能够使用谷歌地图应用程序并进入我的位置(GPS正常工作)。
我尝试了很多方法,比如使用大的超时时间、切换enableHighAccuracy选项、移除选项等等,但都无法获取navigator.geolocation的数据。
以下是我的代码:
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
console.log(`Latitude : ${crd.latitude}`);
console.log(`Longitude: ${crd.longitude}`);
console.log(`More or less ${crd.accuracy} meters.`);
};
function error(err) {
console.warn(`ERROR(${err.code}): ${err.message}`);
};
navigator.geolocation.getCurrentPosition(success, error, options);
我遇到了这个问题:ERROR(3): Location request timed out
{enableHighAccuracy: true, timeout: 20000, maximumAge: 10000}
是什么意思? - Oliver D