0

I tried using Volley to get JSON response but it comes something wrong.

This is my Code.

private fun sendGet() {
        val queue = Volley.newRequestQueue(this)
        val url = "http://localhost/Book/all"

        val stringRequest = JsonObjectRequest(Request.Method.GET, url, null,
                { response ->
                    // Display the first 500 characters of the response string.
                    text!!.text = response.toString()
                },
                { error ->
                    text!!.text = error.toString() })

        queue.add(stringRequest)
    }

But it always requests

com.android. volley. NoConnectionError: java.io. IOException: Cleartext HTTP traffc to localhost not permitted

The server is built from IIS. Where can I change my Code?

1

1 Answer 1

1

You should add the following property in <application> tag of AndroidManifest.xml file: cleartextTrafficPermitted="true"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.