[Solved] HttpUrlConnection working on api level < 11, not working on api level >11 on android


You need to implement all the Network Calls in background Thread via AsyncTask.
Here is a dummy template, you can modify it according to your needs:

private class LongOperation extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... params) {
        //Send your HTTP REQUESTS HERE.
        return "";
    }

    @Override
    protected void onPostExecute(String result) {
        //UPDATE YOUR UI HERE AFTER RETRIEVING DATA FROM HTTP REQUEST
    }

    @Override
    protected void onPreExecute() {}

    @Override
    protected void onProgressUpdate(Void... values) {}
}
}

You need to call this AsyncTask, like this: new LongOperation().execute();
I hope this helps.

0

solved HttpUrlConnection working on api level < 11, not working on api level >11 on android