我正在尝试在黑莓上的小部件应用程序中获取 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");
}