0

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?

5
  • you must debug your code to see why it does not work through mobile data. Commented Aug 10, 2016 at 11:34
  • Just to clarify? is this the IP address of your local host? Commented Aug 10, 2016 at 11:34
  • @ Mohammed Atif Yes.This is the IP address of my localhost. Commented Aug 10, 2016 at 11:36
  • in future you have to buy a domain on a server,then your http://192.168.x.xx will replace with www.your-site.com/mobile_app/" + img_path + "/" + img_name; Commented Aug 10, 2016 at 11:37
  • 1
    @skydroid Thank you. Commented Aug 10, 2016 at 11:39

2 Answers 2

5

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)

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.