Blackberry SDK 5.0及更高版本中的标准和GPS
我目前正在开发一个BB应用程序,我需要得到我目前的职位 在使用v5.0的BB机型中,这是可以的,但在使用v6.0的BB机型中,我总是将locationProvider设置为null。(gps已打开) 有人知道会发生什么事以及如何解决吗 我使用的代码是:Blackberry SDK 5.0及更高版本中的标准和GPS,blackberry,Blackberry,我目前正在开发一个BB应用程序,我需要得到我目前的职位 在使用v5.0的BB机型中,这是可以的,但在使用v6.0的BB机型中,我总是将locationProvider设置为null。(gps已打开) 有人知道会发生什么事以及如何解决吗 我使用的代码是: private boolean startLocationUpdate() { boolean retval = false; try { Criteria criteria = new Criteria();
private boolean startLocationUpdate() {
boolean retval = false;
try {
Criteria criteria = new Criteria();
criteria.setCostAllowed(true);
criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
locationProvider = LocationProvider.getInstance(criteria);
if (locationProvider == null) {
Runnable showGpsUnsupportedDialog = new Runnable() {
public void run() {
Dialog.alert("GPS is not supported on this platform...");
// System.exit( 1 );
}
};
UiApplication.getUiApplication().invokeAndWait(
showGpsUnsupportedDialog); // Ask event-dispatcher
// thread to display dialog
// ASAP.
} else {
locationProvider.setLocationListener(
new LocationListenerImpl(), interval, 1, 1);
retval = true;
}
} catch (LocationException le) {
System.err
.println("Failed to instantiate the LocationProvider object, exiting...");
System.err.println(le);
System.exit(0);
}
return retval;
}
谢谢 根据的API文档,您正在请求Cellsite模式。该文件规定:
a LocationProvider meeting the defined criteria or null if a LocationProvider that meets the defined criteria can't be returned but there are other supported available or temporarily unavailable providers that do not meet the criteria.
因此,API告诉您Cellsite不受支持,但还有其他受支持的模式可用。如果您想使用GPS,您需要指定一个调用自主模式的条件 我尝试了不同的供应商,结果是一样的:S。这真的很奇怪,只有在BB火炬不工作。谢谢你的帮助:)我已经在7.0和7.1上工作了一段时间。我不记得6.0有什么问题。我通常使用空标准。