• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Using my Android app. on a different network?

Hello guys!
I'm not here for the code but more for your ideas/suggestions.

So here's the problem : I managed to make this Android application that can show my DB's records and works just as I wanted.
The code uses a PHP script to connect with a local mySql database and a JSON parser is also used.
Of course, the application works perfectly in my internet connexion since I forwarded the port 80 to my computer by loging into my router.

http://img135.imageshack.us/img135/6646/52938713.png

Now, I'd like to make it... more global?

I'd like for example to use this app in my university's network.
But I can't access the university's router... So how can I use my http://ipaddress/temperature.php script without being able to forward port 80 anymore? And is there any "static" IP adress I can use? (like, not having to change my IP adress on the code everytime I connect to a different network)

Code:
try{
     //commandes httpClient
     HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("[B]http://81.xx.xxx.xxx/temperature.php[/B]");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
     }
     catch(Exception e){
      Log.i("taghttppost",""+e.toString());
            Toast.makeText(getBaseContext(),e.toString() ,Toast.LENGTH_LONG).show();
       }
Any ideas guys how to proceed please ?
Is there a way I can still use my PHP script on any network?

Thanks in advance for any help!
Any suggestion is welcome to solve this issue.

PS : The code used looks a bit like the one here
 
Well... Actually, you're right! xD

When I used my external/internet IP address (like the one found on Adresse Ip - Mon IP - Localiser une adresse IP), it didn't work...
But then I chose the one from cmd/ipconfig and it's working! My bad!
Thanks a lot!

But why on my home's network I have to use my external IP address to make it work, while on the university's network I can just use my local/ipconfig IP address?

Then here's another question: Is there any (easy?) way I can use my app on every network without having to change the IP address on the Eclipse's code everytime?
Like using a fix IP/link etc for every network?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones