I’m trying to make a get request to an API that returns a JSON array on android studio but when I check the logs it says that there was a problem… (I use kotlin by the way)
What did I do wrong?
here is my code:
val url = "http://example.com"
val queue = Volley.newRequestQueue(context)
val jsonArrayRequest = JsonArrayRequest(Request.Method.GET, url, null,
{
Log.d("notification", "successful request!")
},
{
Log.d("notification", "error on request...")
})
queue.add(jsonArrayRequest)
}
2
Answers
After reading Techno World's answer I had an idea. Basically it's the same thing Techno World did but much easier. What I did is to print the response to the log like this:
So when I checked the log I saw this:
After some research I found out that it was because I used http instead of https. So I changed it and it worked!
Here is the original question on stack overflow about that error, there are more methods to solve it...
Try this it will help solve your problem..