0

Currently, I am developing Android instant app. In the feature module, I would like to get json/xml content with http(s) call.

Based on my research, I found 2 ways to do so.

first

val url = URL("https://json or xml url")
val connection: HttpURLConnection = url.openConnection() as HttpURLConnection
val response = connection.responseCode

second

val result = URL("https://json or xml url").readText()

Both does not work.

I use valid url. I typed the url in web browser and able to get what I want.

I add internet connection in manifest xml file as well(base module, feature module). Still the result is unfruitful.

Can you tell me how I can get json/xml content using http(s)call in android instant app(kotlin)?

Thanks

HanJo Jang
  • 23
  • 1
  • 4

0 Answers0