为什么POST请求不能在所有设备上工作?

时间:2018-02-14 16:17:53

标签: android

为什么它不适用于所有设备? 在我的应用程序中90%的设备工作,其中大部分是小米和旧的Android 4.2设备。

抓住尝试说:没有对等证书

DefaultHttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(se());

            try {
                // Add your data
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
                nameValuePairs.add(new BasicNameValuePair("phone", phone));
                nameValuePairs.add(new BasicNameValuePair("password", password));
                nameValuePairs.add(new BasicNameValuePair("url", URL));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity();
                String responseString = EntityUtils.toString(entity, "UTF-8");
                return responseString;
            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                android.util.Log.e("ERROR", e.getMessage());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                android.util.Log.e("ERROR", e.getMessage());
            }

0 个答案:

没有答案