local host api access from Android device -
i have created api in c#, visual studio , running on localhost
address http://localhost:xxxxx/api/allproduct
.
i have created android app in android studio , tried access above api. debugging app using data cable (not emulator). not able access api.
i used chrome://inspect/#devices
, of port forwarding able access api in mobile's browser. when trying connect api through code (app code in android studio), telling "could not connect http://localhost:xxxxx/api/allproduct
".
any 1 please suggest alternate.
remember, localhost
*"this machine."
in other words, "to android, it's android!"
your phone talking itself, not machine that's running api. must provide (or, enable phone locate ...) ip-address of that machine.
Comments
Post a Comment