我正在尝试根据手机信号塔获取BlackBerry中的位置。它似乎工作正常,但突然停止工作。我在构造函数中调用一个线程,以便在App加载时该位置可用:
Thread geolocThread = new Thread()
{
public void run()
{
try
{
BlackBerryCriteria myCriteria = new BlackBerryCriteria(
LocationInfo.GEOLOCATION_MODE);
try
{
BlackBerryLocationProvider myProvider = (
BlackBerryLocationProvider)LocationProvider
.getInstance(myCriteria);
try
{
BlackBerryLocation myLocation = (BlackBerryLocation)
myProvider.getLocation(3000);
final double _longitude = myLocation.getQualifiedCoordinates()
.getLongitude();
final double _latitude = myLocation.getQualifiedCoordinates()
.getLatitude();
Formatter formatter = new Formatter();
String _lati = formatter.formatNumber(_latitude, 6);
String _longi = formatter.formatNumber(_longitude, 6);
lblLatitude.setText(_lati);
lblLongitude.setText(_longi);
}
catch (InterruptedException e)
{Dialog.alert("Exception1:"+e);}
catch (LocationException e)
{Dialog.alert("Exception2:"+e);}
}
catch (LocationException e)
{Dialog.alert("Exception3:"+e);}
}
catch (UnsupportedOperationException e)
{Dialog.alert("Exception4:"+e);}
}
};
geolocThread.start();
现在返回“超时”消息。任何人都可以建议根据手机信号塔获取位置的最佳方法吗?
我也尝试从Google Webservice获取位置,但对此的限制是:
请建议从Cell Tower信息中获取位置的最佳方式。