HTTP Request in Android with Kotlin

 I want to do a login validation using POST method without any third party library and to get some information using GET method.

I've URL, server Username and Password already of my previous project.

Solution -->

For Android, Volley is a good place to get started. For all platforms, you might also want to check out ktor client or http4k which are both good libraries.

However, you can also use standard Java libraries like which is part of the Java SDK:

fun sendGet() {
    val url = URL("")

    with(url.openConnection() as HttpURLConnection) {
        requestMethod = "GET"  // optional default is GET

        println("\nSent 'GET' request to URL : $url; Response Code : $responseCode")

        inputStream.bufferedReader().use {
            it.lines().forEach { line ->
Or simpler:


Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.