小编Ahm*_*.A.的帖子

GPS Geolocation应用程序无法在Phonegap for Android中使用

我正在创建一个获取用户位置的应用程序.应用程序使用3G正常工作,问题来自我禁用3G并想要只使用GPS运行应用程序,应用程序甚至无法启动.

我有的代码:

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
}

function onSuccess(position) {
    var element = document.getElementById('geolocation');
    element.innerHTML = 'Latitude: '           + position.coords.latitude              + '<br />' +
                        'Longitude: '          + position.coords.longitude             + '<br />' +
                        'Altitude: '           + position.coords.altitude              + '<br />' +
                        'Accuracy: '           + position.coords.accuracy              + '<br />' +
                        'Altitude Accuracy: '  + position.coords.altitudeAccuracy      + '<br />' +
                        'Heading: '            + position.coords.heading               + '<br />' +
                        'Speed: '              + position.coords.speed                 + '<br />' +
                        'Timestamp: '          + …
Run Code Online (Sandbox Code Playgroud)

android geolocation cordova

0
推荐指数
1
解决办法
1392
查看次数

标签 统计

android ×1

cordova ×1

geolocation ×1