Is it possible to Enable TLS 1.2 in android 4.4

429 Views Asked by At

I have an existing android app which runs on Android EMDK TC70 device. Server team has upgraded the endpoints to the new server. When i try to change the endpoints to new endpoints requests are not going to backend server. Server has been upgraded to TLS1.2. In response i am getting an exception "SSL handshake Exception connection closed by PEER"

But when i run the same request in the Postman the response is fine.

If i run the same request in the normal android sample application the response is fine.

My problem is its not working on TC70 device.

TC70 device currently i have the OS version of 4.4 (not able to update)

Can you please help me. how to resolve the issue ?

       HttpURLConnection con  = (HttpURLConnection)obj.openConnection();

        con.setRequestProperty("Accept", "application/json");

        con.setRequestProperty("Content-Type", "application/json");
        con.setRequestProperty ("Authorization", basicAuth);
      //  con.setRequestProperty("access-control-allow-origin", url);
        //con.setRequestProperty("Content-Length","409");
        con.setConnectTimeout(600000);// 60 sec
        con.setReadTimeout(600000);
        //con.setDoInput(true);
        //con.setDoOutput(true);
        String postJsonData = getJSonRequest(map);
        con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
        con.setDoOutput(false);
        DataOutputStream wr = new DataOutputStream(con.getOutputStream());
        wr.writeBytes(postJsonData);
        wr.flush();
        wr.close();
        int responseCode;
        responseCode = con.getResponseCode();
        Log.e(TAG, String.valueOf(responseCode));
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String output;
        StringBuffer response = new StringBuffer();
        try {
            while ((output = in.readLine()) != null) {
                response.append(output);

            }
        } catch (IOException e) {
            e.printStackTrace();

        }
        in.close();
0

There are 0 best solutions below