phonegapを使用してAndroidアプリケーションを開発しています。アプリでは、xmlrpcrequest リクエストを使用します。接続が遅いためにリクエストを行うと、リクエストがタイムアウトになり、次のエラーが表示されることがあります
E/WebUrlLoaderClient(574): 0 回目の試行で 10 秒後に同期要求がタイムアウトしました
とにかくこのエラーを「キャッチ」するか、タイムアウト時間を増やすことはありますか??
phonegap 2.8.1 にアップデートしてから同じ問題が発生しました。使用しているバージョンは何ですか? ajax引数のタイムアウトをまったくリッスンしていないようです:
var dataObj = { 'value': whatever'};
//navigator.notification.alert(JSON.stringify(dataObj));
$.ajax({
type: 'POST',
url: url,
async: false,
data: JSON.stringify(dataObj),
dataType: 'json',
timeout: 25000,
contentType: 'application/json; charset=utf-8',
crossDomain: true,
xhrFields: {
withCredentials: true
},
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + Base64.encode(username + ":" + password));
},
success: post_succes,
error: function(xhr, status, errThrown) {
var out = "<br>Error status " + status;
out += "<br>Error request status text: " + xhr.statusText;
out += "<br>Error request status: " + xhr.status;
out += "<br>Error request response text: " + xhr.responseText;
out += "<br>Error response header: " + xhr.getAllResponseHeaders();
navigator.notification.alert(out);
}
});
また、Javaメインでこの値を設定しようとしました:(これが正しいプロパティではないことはわかっています...しかし、必死にそれを理解しています...)
super.setIntegerProperty("loadUrlTimeoutValue", 25000);
それは10秒に固執し続けます....