I am new to Android Development.I wanted to clarify one doubt.Can anyone tell me.I am uploading image to the server using IP address.i.e. String url = "http://192.168.x.xx/mobile_app/" + img_path + "/" + img_name;
If I use mobile data,my app doesn't work.If I connect to same network(using WiFi in mobile) it works.In future if I upload my app to play store whether it creates a problem?or it works fine for every user?
2 Answers
It can't work if you're using mobile data. That's because you're using an ip address that is only valid within your wifi network.
If you're going to upload your app in the play store then you should move your server to the cloud and use a public ip address (of course the ip should be fixed)
Comments
One thing that you must know is you can not access your locahost server from any network other than your network group. In your case your laptop/pc is connected to same network in which your wifi router is connected and hence you are able to connect to it. But if you want to connect to the server from any network then you need to push your server to public server. There are many free servers that allows you to host your code on it.
http://192.168.x.xxwill replace withwww.your-site.com/mobile_app/" + img_path + "/" + img_name;