gpt4 book ai didi

android - Cordova 5.0.0 上的地理定位插件总是返回超时过期错误

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:56:38 24 4
gpt4 key购买 nike

我已经使用这些插件安装了 Cordova 5.0.0:

cordova插件列表

cordova-plugin-device 1.0.1-dev "Device"
cordova-plugin-geolocation 1.0.0 "Geolocation"
cordova-plugin-globalization 1.0.0 "Globalization"
cordova-plugin-inappbrowser 1.0.1-dev "InAppBrowser"
cordova-plugin-network-information 1.0.0 "Network Information"
cordova-plugin-whitelist 1.0.1-dev "Whitelist"

在任何安卓虚拟设备上运行这段代码:

onDeviceReady: function () {

var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};

// onError Callback receives a PositionError object
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
var options = { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true };
navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
}

返回:

D/CordovaNetworkManager( 1239): Connection Type: 3g
D/CordovaNetworkManager( 1239): Connection Extra Info: epc.tmobile.com
D/CordovaWebViewImpl( 1239): onPageFinished(file:///android_asset/www/index.html)
D/dalvikvm( 1239): GC_EXTERNAL_ALLOC freed 457K, 49% free 3174K/6151K, external 901K/1038K, paused 3ms
I/InputReader( 843): Device reconfigured: id=0x0, name=qwerty2, display size is now 240x400
I/InputManager-Callbacks( 843): No virtual keys found for device qwerty2.
D/SystemWebChromeClient( 1239): file:///android_asset/www/js/app.js: Line 127 : code: 3
D/SystemWebChromeClient( 1239): message: Timeout expired

为什么总是返回超时过期?

最佳答案

这听起来很愚蠢,但是,您是否激活了手机中的“GPS”选项?

关于android - Cordova 5.0.0 上的地理定位插件总是返回超时过期错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30409394/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com