I have been using ngrok for a bunch of projects, mostly voice apps and rest apis. I just needed to use my rest api in an android app. However, whatever I do, it does not work for some reasons!
If I try it with http, this is the error I get:
E/Volley: [17118] BasicNetwork.performRequest: Unexpected response code 307 for http://1z5d90b4.ngrok.io/api/v1/users/id/
I/System.out: That didn't work! com.android.volley.ServerError
If I try the https link, this is what I get:
com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xd7821100: I/O error during system call, Connection reset by peer
I don't know why and what is going on! I checked ngrok runnign on my computer, and it does not receive anything. FYI, I am making a post request on that url using Volley in Kotlin, this is my code:
val queue = Volley.newRequestQueue(this)
// Request a string response from the provided URL.
val stringRequest = JsonObjectRequest(Request.Method.POST, apiUrl, params,
Response.Listener { response ->
// Display the first 500 characters of the response string.
println("Response is: $response")
},
Response.ErrorListener { error -> println("That didn't work! ${error}") })
queue.add(stringRequest)