0

我正在尝试在黑莓上的小部件应用程序中获取 GPS 位置,但 API 始终返回 0,0 的纬度和经度。

模拟器:storm 2 (9550)/bold(9700) 和操作系统:5.0/5.0

IDE:日食

html页面代码如下:

var modeCellsite   = 0;
var modeAssisted   = 1;
var modeAutonomous = 2;

function locationChanged()
{

    alert("Lat " + blackberry.location.latitude +
          " Lon " + blackberry.location.longitude +
          " Time " + blackberry.location.timestamp );
    return true;
}

if ( window.blackberry && blackberry.location.GPSSupported )
{
    var isUpdated = false;
    var theCount = 0;
    alert("Location tracking is supported");
    blackberry.location.onLocationUpdate("locationChanged()");
    blackberry.location.setAidMode(modeAutonomous);
    while ( theCount++ < 10 && !isUpdated )
        isUpdated = blackberry.location.refreshLocation();
}
else
{
    document.write("Location tracking is not supported");
}
4

1 回答 1

0

确保在运行小部件之前在 SIM 中打开 GPS。

For Example in the simulator goto:
    Simulate -> GPS Location...
    Under Route Click "add"
    Choice Random Route Generator
       Number of Legs 1000
       Travel Time 600
       click OK
    Click Play arrow
于 2010-10-22T05:12:44.160 回答