0

我开发了一个使用 phonegap 来检索地理位置的应用程序。

function getLoc() {
    navigator.geolocation.getCurrentPosition(onSuccess, onError, { enableHighAccuracy: true });
}

// onSuccess Geolocation
function onSuccess(position) {
    var locInfo = new Object();

    locInfo.Latitude = position.coords.latitude;
    locInfo.Longitude = position.coords.longitude;
    locInfo.Altitude = position.coords.altitude;
    locInfo.Accuracy = position.coords.accuracy;
    locInfo.AltitudeAccuracy = position.coords.altitudeAccuracy;
    locInfo.Heading = position.coords.heading;
    locInfo.Speed = position.coords.speed;

    alert(locInfo.Latitude + "   " + locInfo.Longitude);
}

// onError Callback receives a PositionError object
function onError(error) {
    alert('code: '    + error.code    + '\n' +
          'message: ' + error.message + '\n');
}

上面的代码在 Android、iPhone 和 BlackBerry Simulator 中运行良好,但在 BlackBerry 设备中却不行。我正在使用 BlackBerry Torch 进行测试。

可能是什么问题。请回复。

谢谢 :)

4

1 回答 1

0

尝试为getCurrentPosition.

于 2012-06-14T11:39:54.827 回答