0

I have created an API in DjangoREST,and it is running on my localhost with address http://localhost:xxxxx/api/allproduct.

I have also created an Android app in Futter, using Android Studio and tried to access the above API. I am debugging my app using data cable (Not by emulator). I am not able to access the API. I must test the application with cable not on emulator, any leads please.

1 Answers1

1

I use a proxy service called ngrok. After installing, you can run it like:

ngrok http 8080 (assuming your localhost is serving on port 8080)

It will create a tunnel, both that'll work for both HTTP and HTTPS (so iOS devices don't reject the request, due to an insecure protocol)

Then, you just need to replace your http://localhost with the host from ngrok, that will look something like this:

http://xxxx-xxxx-xxx-...-xxxx.ngrok.io

It will even give you a web interface that you can go to, to review traffic:

http://127.0.0.1:4040

Jared Anderton
  • 826
  • 9
  • 12