android – navigator.geolocation.getCurrentPosition总是得到一个错误代码3:超时已过期

我使用cordova-2.0.0和 android模拟器Google Api level16.

每当我运行navigator.geolocation.getCurrentPosition我总是得到错误3.
我的代码简介如下:

// Wait for Cordova to load
            document.addEventListener("deviceready",onDeviceReady,false);

            // Cordova is ready
            function onDeviceReady() {
                console.log("Entering index.html.onDeviceReady");
                var networkState = navigator.network.connection.type;
                getPosition(networkState);
}

function getPosition(networkState) {
    console.log("Entering getPosition function");
    console.log("networkState is: " + networkState);
    if (networkState !== null) {
        navigator.geolocation.getCurrentPosition(onSuccess,onError,{
            maximumAge : Infinity,timeout : 5000,enableHighAccuracy : true
        });
    } else {
        alert('Please check your network connection and try again.');
    }
    console.log("Leaving getPosition function");
}

// function for lat & lng
function onSuccess(position) {
    console.log("Entering onSuccess(position) function");
    console.log("Latitude is: " + position.coords.latitude);
    console.log("longitude is: " + position.coords.longitude);
    lat = position.coords.latitude;
    lng = position.coords.longitude;
    console.log("Leaving onSuccess(position) function");
}

// function for lat & lng
function onError(error) {
    console.log("Entering onError(error) function");
    alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');
    console.log("Leaving onError(error) function");
}

如果有人想到为什么错误3被提出,请提出建议.非常感谢

解决方法

我确定了
enableHighAccuracy: false

也是,但是发现“错误代码3”不断弹出…
也不

browser / settings / privacy and security / position / delete position access data

做了帮助…
只有电力循环(但我认为浏览器杀死会做同样的事情)Android(4.1.2)强制浏览器重复“共享位置”问题.给用户,将错误代码3丢出门

我想在某些情况下(我不能重复,对不起)浏览器存储该网站的无效位置 – 或 – 记住该网站的共享拒绝…

对不起迟到的回答(也许在一个不完整的方式)…如果有更好的证据请分享

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...