BlackBerry Widget 应用程序 - GPS 位置始终为 0,0
我试图在黑莓手机上的小部件应用程序中获取 GPS 位置,但 API 始终返回纬度和经度 0,0。
模拟器:storm 2 (9550)/bold(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");
}
I am trying to get the GPS location in a widget application on a blackberry, but the API always returns a latitude and longitude of 0,0.
Simulator: storm 2 (9550)/ bold(9700) and OS: 5.0/5.0
IDE:Eclipse
the html page code as below:
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");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在运行小部件之前,请确保您已打开 SIM 卡中的 GPS。
Make sure you turned ON GPS in the SIM before running your widget.