0

Blackberry アプリケーションで GPS から現在地を取得する方法。シミュレーターから位置情報を取得しようとしましLocationmanager methodたが、正常に動作しましたが、デバイス (Wi-Fi を使用するストーム 2) では現在の緯度経度を取得できません。

私のコード

    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  
    }  
}
4

1 に答える 1

1

嵐の問題を探した最初の場所でこれを見つけました:If you run the above code on your BlackBerry device (for instance a Storm), you will get a "GPS not allowed" LocationProvider exception. You need to get your code signed if you want to use the BlackBerry Storm with GPS in your app. To do this, you need to buy a $20 certificate from RIM.

于 2011-09-26T13:25:39.757 に答える