【问题标题】:Geolocation error in androidAndroid中的地理定位错误
【发布时间】:2013-10-16 20:59:23
【问题描述】:

下面是代码

if (navigator.geolocation) {
        alert("ok");

       // var options = { timeout: 0, maximumAge: 600000 };
        navigator.geolocation.watchPosition(onSuccess, onError);

    }
function onSuccess(position) {
    alert("success");
    lat = position.coords.latitude;
    lng = position.coords.longitude;

}
function onError(error) {
    alert('code: ' + error.code + '\n' +
           'message: ' + error.message + '\n');
}

它适用于所有浏览器,iphone 和 WindowsPhone。但是在andorid中给了我错误代码:3 timeout expired error。

我也在设置菜单-->定位服务-->定位和谷歌搜索中启用了gps、wi-fi, 在浏览器菜单设置-->隐私和设置启用位置被选中。

有什么问题,有什么想法吗?我真的卡住了。

【问题讨论】:

    标签: android geolocation


    【解决方案1】:

    通常,我们接受想要分享您的位置的网站请求。

    在 android 中,如果您没有看到问题,请在浏览器设置中 advanced--> website settings 将您的 URL 添加到那里。

    它解决了问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-17
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      • 2018-09-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多