king
king

Reputation: 507

Local Http request Android

I'm developping an app and I need to store the result of the game in my database. I'm gonna do a local server for that. I already saw how to send a request with android. I just want to know how to do it locally. I dont know anything in network so I would like to know if it's different from doing to a non-local server. I want to know if doing localhost:8080/mypage?params is gonna be all right or if I need to be on the same wifi spot to do it, or if I need to do something specific.

Thanks

Upvotes: 1

Views: 479

Answers (1)

cherif
cherif

Reputation: 1344

As comment said,

Doing localhost on any device will go to itself

You need to use the server real IP. Probably, you have dynamic IP, that means your IP is going to change every time you reset your router, so you need to use a Dynamic DNS service, for example: http://www.dnsexit.com/

Moreover, you're going to need to open corresponding port in your router if the app is going to run out of your LAN.

As comment said:

that is networking 101

Upvotes: 2

Related Questions