Consume Retrofit json on my real device (smartphone)

Asked

Viewed 41 times

0

I made an apirest with Springboot that works perfectly by the browser at the address.

http://localhost:8080/pessoas_escalas

I can consume the service locally by the Android Studio emulator, through the address set in Retrofit.

.baseUrl("http://10.0.2.2:3000/")

In this sense, I would like to read the Json that is locally, by my real device(smartphone). How should I proceed?

1 answer

0


Executes the ipconfig on your machine and picks up the ip. Then uses your ip and port in your code with retrofit to consume.

Call of the Retrofit:

Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://192.168.25.10:8080/pessoas_escalas")
.build();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.