0

Blackberry ウィジェットの作成を試していますが、少し問題があります。

私の最初の試行では、ボタンをクリックすると、携帯電話に緯度と経度を警告する JavaScript 関数を呼び出します。

関数は次のようになります。

function whereAmI() {
var latitude = blackberry.location.latitude;
var longitude = blackberry.location.longitude;
alert("Lat: "+latitude+", Long: "+longitude);
}

ただし、「緯度: 0、経度: 0」というアラートのみが表示されます。確認したところ、GPS は正常に機能しているようです。

Curve 8900 で OS 5.* を実行しています。

どんな助けでも大歓迎です:)

4

2 に答える 2

1

ファイルに適切に署名していないことに気付きました - 今ではすべて正常に動作しています。

かばんの場合:

      // called when location object changes
  function locationCB()
  {
     alert("Latitude "  + blackberry.location.latitude);
     alert("Longitude " + blackberry.location.longitude);
     return true;
 }
 // test to see if the blackberry location API is supported
 if( window.blackberry && blackberry.location.GPSSupported)
 {
       document.write("GPS Supported");

       // Set our call back function
       blackberry.location.onLocationUpdate("locationCB()");

       // set to Autonomous mode
       blackberry.location.setAidMode(2);

       //refresh the location
       blackberry.location.refreshLocation();
 }
 else
 {
   document.write("This Device doesn't support the Blackberry Location API");
 }
于 2010-05-28T13:52:40.913 に答える
0

あなたのウィジェットは GPS を使用する権限を持っていますか? [オプション] -> [アプリケーション] に移動し、アプリを選択してから [権限の編集] を選択します。[接続] の [位置データ] が [許可] に設定されていることを確認します。

于 2010-05-21T06:03:02.730 に答える