Consume json Retrofit in my real device (smartphone)

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 from the Android Studio emulator via 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?

    
asked by anonymous 12.10.2018 / 22:09

1 answer

0

Run ipconfig on your machine and get ip. Then use your ip and port in your retrofitting code to consume.

Retrofit Call:

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