0
안녕하세요 JSON에서 서버에서 응답을 얻을 수 LoopJ lib 디렉토리를 사용하고 있습니다. 하지만 문제는 때때로 org.apache.http.conn.ConnectTimeoutException이 발생하고 때로는 정상적으로 실행된다는 것입니다. GET 메서드를 사용하고 있습니다. 내가 복사하고 내 브라우저에 URL을 붙여 넣을 때 이제까지 그러나 그것은 잘 실행하지만 안드로이드 장치에 나는 대부분 질수는 문제가 어떤 서버에 연결합니다. 내가 도대체 뭘 잘못하고있는 겁니까 ?안드로이드 비동기 HTTP를 클라이언트
client.setTimeout(timoutVal);
client.get(
"http://somewebsiteaddress.com/users.php?task=isUserPresent&email="
+ URLEncoder.encode(username) + "&password="
+ URLEncoder.encode(password) + "&licenseKey="
+ URLEncoder.encode(licKey), null,
new AsyncHttpResponseHandler() {
public void onSuccess(String response) {
loading.cancel();
Log.v("web response ", response);
try {
json = new JSONObject(response);
if (json.getBoolean("status")) {
delegate.Validation(
json.getBoolean("isUserPresent"),
json.getBoolean("license"), username,
password, json);
} else {
delegate.invalidLogin();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Throwable arg) {
Log.v("onFailure", arg + "");
loading.cancel();
delegate.InternetErrorDialog();
super.onFailure(arg);
}
});
그냥 이유를 언급 : HTTP 서버에 연결하거나 사용 가능한 connection' 기다리는 동안 http://developer.android.com/reference/org/apache/http/conn/ConnectTimeoutException.html 때문에 시간 제한 '이 될 수 있음 . –