loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
String userName = editTextEmail.getText().toString().trim();
String password editTextPassword.getText().toString().trim();
String LOGIN_URL = "http://www.someurl.com/Rest/AIwebservice/Authenticate?user="+userName+"&password="+password;
//String uri = String.format("https://www.auruminfo.com/Rest/AIwebservice/Authenticate?user=subhash&password=Subhash");
//String uri = String.format("https://www.someurl.com/Rest/AIwebservice/Authenticate?user="+userName+"&password="+password);
StringRequest sr = new StringRequest(Request.Method.GET,LOGIN_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("HttpClient", "success! response: " + response.toString());
}
},new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("HttpClient", "error: error.toString());
}
})
{
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put("user","");
params.put("password","");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params = new HashMap<String, String>();
params.put("Content-Type","application/json;charset=UTF-8");
return params;
}
};
queue.add(sr);
}
});
}
and Log Cat:-
08-02 18:17:08.778 7070-7091/com.some.eww.logindemo E/Volley: [9414] BasicNetwork.performRequest: Request at http://www.someurl.com/Rest/AIwebservice/Authenticate?user=&password= has been redirected to https://www.someurl.com/Rest/AIwebservice/Authenticate?user=&password= 08-02 18:17:08.794 7070-7070/com.anghatechsolution.eww.logindemo E/HttpClient: error: com.android.volley.RedirectError
I found the issue in my case in String LOGIN_URL = " http://www.someurl.com ;
The original API uses HTTPS not HTTP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.