2011-11-11 21 views
0

Titanサンプルの次のコードは、iPhoneではうまく動作しますが、Androidではうまく動作しません。誰かがこれがAndroid 2.3.3でも動作するように書かれる方法を私に見せてもらえますか?私が 'Ti.Geolocation.getCurrentPosition'とそれを終了タグとコメントアウトすると、エラーは表示されません。Appcelerator Androidでジオロケーションが動作しない

if (!_bounty.captured) { 
    var captureButton = Ti.UI.createButton({ 
     title:L('capture'), 
     top:10, 
     height:30, 
     width:200 
    }); 
    captureButton.addEventListener('click', function() { 
     if (Ti.Geolocation.locationServicesEnabled) { 
      Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST; 
      Ti.Geolocation.getCurrentPosition(function(e) { //*causes error on Android* 
       var lng = e.coords.longitude; 
       var lat = e.coords.latitude; 
       bh.db.bust(_bounty.id, lat, lng); 

       bh.net.bustFugitive(Ti.Platform.id, function(_data) { 
        Ti.UI.createAlertDialog({ 
         message:_data.message 
        }).show(); 

        //on android, give a bit of a delay before closing the window... 
        if (Ti.Platform.osname == 'android') { 
         setTimeout(function() { 
          win.close(); 
         },2000); 
        } 
        else { 
         win.close(); 
        } 
       }); 
      }); 
     } 
     else { 
      Ti.UI.createAlertDialog({ 
       title:L('geo_error'), 
       message:L('geo_error_details') 
      }).show(); 
     } 
    }); 
    win.add(captureButton); 
} 

助けてください。

+0

エラーメッセージは何ですか?どのTiバージョン? –

+0

Tiバージョン1.7.5、 ランタイムエラー: \t場所:android_asset/Resources/ui.js; \tメッセージ:構文解析中に再帰が多すぎます – basheps

+0

Android用Tiバグのように聞こえます。以前のバージョンのTi Mobile SDKを試してみましたか? –

答えて

-1

Androidでジオロケーションを使用するにはGoogle API SDKを使用する必要があります

関連する問題