val params = RequestParams()
params.put("userid", prefs!!.getLong("userid", 0))
params.put("lastid", lastID)
val client = AsyncHttpClient()
client.post("$domain/xxx.php", params, object : JsonHttpResponseHandler() {
override fun onSuccess(statusCode: Int, headers: Array<Header>?, response: JSONArray?) {
}
override fun onFailure(statusCode: Int, headers: Array<Header>?, e: Throwable, response: JSONArray?) {
}
})
It works on API 26 but not on 23, apparently ssl url is the problem.
The solution here: how to make HTTPS calls using AsyncHttpClient?
isn't working, apparently because SSLSocketFactory
is deprecated since API 22.
Then I tried using volley but it's a bad alternative because for what ever reasons you can't send POST parameters when receiving JSONArray.
Is there a solution?