1
我使用齐射为登录功能,但我得到意外的响应代码400为https。 它适用于wifi,但不适用于蜂窝网络,而且问题只发生在选定的手机型号上。下面我粘贴了我的代码。公共无效LoginRequest(最终的字符串用户名,最终的字符串密码,最终的ActionResponse成功,最终的行动错误){ RequestQueue队列= MVolleyRequests.getInstance(mContext).getRequestQueue();Android Volley意外的响应代码400
StringRequest sr = new StringRequest(com.android.volley.Request.Method.POST,LOGIN_URL,
new Listener<String>() {
@Override
public void onResponse(String response) {
success.action(MError.getError(Integer.parseInt(response)));
}
}, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
err.action();
}
}){
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put("id", username);
params.put("pwd", password);
params.put("version", "2.5");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params = new HashMap<String, String>();
params.put("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
return params;
}
};
sr.setRetryPolicy(new DefaultRetryPolicy(
60000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MVolleyRequests.getInstance(mContext).addToRequestQueue(sr);
}
你打给哪个网址? – 2014-10-07 14:09:37
@ A.S。它是一个https链接 – 2014-10-07 15:12:30