1

I am doing login application (post api) with volley but I am getting no connection on error javax.net.ssl.sslhandshakeexception error. I checked in all versions and same error I am getting please clear this doubt. This is my code:

private void LoginUser() {
    if (awesomeValidation.validate()) {
        final String username = et_nameemail.getText().toString().trim();
        final String password = et_password.getText().toString().trim();
        final String deviceId = "";
        final String deviceType = "";
        HttpsTrustManager.allowAllSSL();
        StringRequest stringRequest = new StringRequest(Request.Method.POST, URLline,
                new com.android.volley.Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Toast.makeText(Login_Activity.this, response, Toast.LENGTH_LONG).show();
                        parseData(response);
                    }
                    private void parseData(String response) {
                        try {
                            JSONObject jsonObject = new JSONObject(response);
                            if (jsonObject.getString("status").equals("OK")) {
                                Intent intent = new Intent(Login_Activity.this, HomeOwner.class);
                                startActivity(intent);
                            } else {
                                Toast.makeText(Login_Activity.this, "error ", Toast.LENGTH_LONG).show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(Login_Activity.this, error.toString(), Toast.LENGTH_LONG).show();
                    }
                }) {
                @Override
                protected Map<String, String> getParams() {
                    Map<String, String> params = new HashMap<String, String>();
                    params.put("email", username);
                    params.put("password", password);
                    return params;
                }
            };
        RequestQueue requestQueue = Volley.newRequestQueue(Login_Activity.this);
        requestQueue.add(stringRequest);
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        }
    }
});
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
srilekha
  • 21
  • 2
  • I got this problem before, you need to add SSL certificate manually to your project. check the accepted answer in this question: https://stackoverflow.com/questions/55992416/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-pa it will solve your problem. – Amin Jan 25 '20 at 14:20

0 Answers0