相关疑难解决方法(0)

AsyncTask HttpPost在3G上执行失败,但适用于Wifi

我需要在Web服务上做一些字符串的Http帖子.我正在使用KSoap.

@Override
protected JSONObject doInBackground(JSONObject... params) {
    String result;

    HttpParams httpParameters = new BasicHttpParams();
    // Set the timeout in milliseconds until a connection is established.
    // The default value is zero, that means the timeout is not used. 
    int timeoutConnection = 30000;
    HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
    // Set the default socket timeout (SO_TIMEOUT) 
    // in milliseconds which is the timeout for waiting for data.
    int timeoutSocket = 50000;
    HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

    HttpClient httpclient = new DefaultHttpClient(httpParameters);
    setupClient(httpclient);
    //HttpURLConnection httpclient = new HttpURLConnection(_url);

    Log.d(TAG, …
Run Code Online (Sandbox Code Playgroud)

android ksoap2 android-asynctask

13
推荐指数
1
解决办法
3821
查看次数

标签 统计

android ×1

android-asynctask ×1

ksoap2 ×1