我想要在黑莓手機上的widget應用程序中獲取GPS位置,但API始終返回0,0的經度和緯度。BlackBerry Widget應用程序 - GPS位置總是爲0,0
模擬器:風暴2(9550)/加粗(9700)和OS: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");
}
我有同樣的問題,與略有不同,但spritually simial JS。 – Nilloc 2010-12-07 21:36:54