如何從黑莓應用程序中的GPS獲取當前位置。我試圖從模擬器Locationmanager method
獲得位置,但是在我的設備中(Storm 2使用wifi),我無法獲得當前經緯度。在黑莓應用程序中從GPS獲取當前位置
我的代碼
private class LocationListenerImpl implements LocationListener {
public void locationUpdated(LocationProvider provider, Location location) {
if (location.isValid()) {
heading = location.getCourse();
longitude = location.getQualifiedCoordinates().getLongitude();
latitude = location.getQualifiedCoordinates().getLatitude();
altitude = location.getQualifiedCoordinates().getAltitude();
speed = location.getSpeed();
// This is to get the Number of Satellites
String NMEA_MIME = "application/X-jsr179-location-nmea";
satCountStr = location.getExtraInfo("satellites");
if (satCountStr == null) {
satCountStr = location.getExtraInfo(NMEA_MIME);
}
// this is to get the accuracy of the GPS Cords
QualifiedCoordinates qc = location.getQualifiedCoordinates();
accuracy = qc.getHorizontalAccuracy();
}
}
public void providerStateChanged(LocationProvider provider, int newState) {
// no-op
}
}
沒有關於您的問題足夠的信息 - 在GPS開啓?你的代碼是否符合黑莓的方式?你有沒有要求的應用程序的權限? – KevinDTimm
GPS已啓用。是的代碼是在黑莓的方式和它的工作在模擬器後發送經緯度從GPS系統。第三關於許可?我不知道你在說什麼嗎? – Hitarth
如果您有任何想法,請幫我 – Hitarth