使用 GPS(位置 API)时出现位置异常

发布于 2024-10-25 13:38:33 字数 1468 浏览 0 评论 0原文

我已经在 sonyerricsom T700 移动设备上下载了谷歌地图应用程序,它工作正常,它的 java 应用程序。所以根据我的理解,它也使用位置 API。 此链接显示它没有GPS。 但它显示地图,甚至在谷歌地图上定位设备上点击的照片。

所以我使用Location API(JSR-179)在j2me中尝试了下面的代码。它在模拟器上工作正常。 但是当我在索尼 erisccon T700 移动设备上尝试相同的操作时,它给出了以下异常:

异常:

javax.microedition.location.LocationException:All service providers are out of service.

代码:

try {

// Create a Criteria object for defining desired selection criteria
Criteria cr = new Criteria();
LocationProvider lp = LocationProvider.getInstance(cr);    
l = lp.getLocation(60);    
c = l.getQualifiedCoordinates();    
//cityMap.setCategories(selectedCategories);
if (c != null) {
// use coordinate information
double lat = c.getLatitude();    
//latitude="";
latitude = ""+lat;
Latitude.setString(latitude);
double lon = c.getLongitude();
longitude =""+lon;
Longitude.setString(longitude);
}
}
catch (LocationException e) {
alert = new Alert("LocationException");
alert.setString("Unable to retrive location information:" + e);
alert.setTimeout(2000);
display.setCurrent(alert);
// not able to retrive location information
//e.printStackTrace();
} catch (InterruptedException ie) {
alert = new Alert("InterruptedException");
alert.setString("Operation Interrupted:" + ie);
alert.setTimeout(2000);
display.setCurrent(alert);    
}    
}

请建议我对此的任何解决方案...

谢谢并致以问候。

I have downloaded google map application on sonyerricsom T700 mobile its working fine,its java application.So as per my understanding that is also using Location API.
This link shows that it does not have GPS.
But it is showing map and even locating photo's clicked on device on google map.

So I am tried below code in j2me using Location API(JSR-179).Its working fine on emulator.
But when I am trying the same on Sony erisccon T700 mobile its giving below exception:

Exception:

javax.microedition.location.LocationException:All service providers are out of service.

Code:

try {

// Create a Criteria object for defining desired selection criteria
Criteria cr = new Criteria();
LocationProvider lp = LocationProvider.getInstance(cr);    
l = lp.getLocation(60);    
c = l.getQualifiedCoordinates();    
//cityMap.setCategories(selectedCategories);
if (c != null) {
// use coordinate information
double lat = c.getLatitude();    
//latitude="";
latitude = ""+lat;
Latitude.setString(latitude);
double lon = c.getLongitude();
longitude =""+lon;
Longitude.setString(longitude);
}
}
catch (LocationException e) {
alert = new Alert("LocationException");
alert.setString("Unable to retrive location information:" + e);
alert.setTimeout(2000);
display.setCurrent(alert);
// not able to retrive location information
//e.printStackTrace();
} catch (InterruptedException ie) {
alert = new Alert("InterruptedException");
alert.setString("Operation Interrupted:" + ie);
alert.setTimeout(2000);
display.setCurrent(alert);    
}    
}

Please suggest me any solution for this...

Thank and regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北方。的韩爷 2024-11-01 13:38:33

是的,我敢打赌这不是您从 GPS 获得的准确位置。

Google 还有其他方式来查找您的位置……可能是使用 Cell ID。幸运的是,索尼爱立信手机很容易找到 Cell ID,请参阅此处。获得后,您可以在 cell ID 数据库中查找它以查找位置。

Yeah, I bet it's not exact location like you would get from GPS.

Google has other ways of finding your location... it's probably using Cell ID. Luckily Sony Ericsson handsets are quite easy to find Cell ID from, see here. Once you have it, you can look it up in a cell ID database to find location.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文