0

I'm currently working with an android app that retrieves data from MySQL database thru PHP. I run my app in an android device, not in emulator. I succeeded on retrieving those data, but when i changed my wifi connection on the phone, it returns null. So i tried to reconnect from the previos wifi connection, it succeeded again. Is there anyone who has an idea on this? thanks much

  • check net connection is here or not http://www.androidhive.info/2012/07/android-detect-internet-connection-status/ – Naveen Tamrakar Oct 29 '14 at 05:48
  • use broadcast receiver in your activity, that shows your internet connection changes in your phone.based your retrieving data by internet. – prakash Oct 29 '14 at 05:48
  • if net id here than code id run outher wise not in here in phone http://stackoverflow.com/questions/4238921/detect-whether-there-is-an-internet-connection-available-on-android – Naveen Tamrakar Oct 29 '14 at 05:49
  • Please add the code. Seems like you may be pinging to a server connected to a local network. – vkm Oct 29 '14 at 05:53

1 Answers1

0

The problem might be with your web service server.

If you host your web services in a local server and your wifi connection is inside that network, you can access the services locally.

Make sure to publish the web services in a public server instead of your local server and connect to the public IP, then you can able to connect with any wifi connection.

Akhil
  • 189
  • 7