我正在尝试在黑莓手机上的小部件应用程序中获取GPS位置,但API始终返回0,0的纬度和经度。
模拟器:风暴2(9550)/粗体(9700)和操作系统:5.0 / 5.0
IDE:Eclipse的
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");
}
答案 0 :(得分: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