0
在Android中,我的工作與REST的API使用HTTPS協議SSLPeerUnverifiedException使用HTTPS工作在Android的
HttpResponse response = null;
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(UrlConnectionConstants.SCI_TA_AGENT_URL));
response = client.execute(request);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return response;
導致SSLPeerUnverifiedException一段時間。
我想'HttpClient'已棄用,但我建議你使用'HttpURLConnection'爲'http'連接和'HttpsURLConnection' 'https'連接 更多信息http://stackoverflow.com/questions/22095813/androidhttpclient-versus-httpurlconnection-for-api-level-9-and-above#answer-22096707 – Deb
沒有'SSLPeerUnspicifiedException'。你的意思是'SSLPeerUnverifiedException'嗎? – Robert
感謝您的回覆,但我也有同樣的問題與HttpsURLConnection類也 –