0

My application runs fine when I try running with Emulator, but when I try running with my Mobile Nexus-5 the application does not run.

I have the server in my system only. I am using Xampp Local host server. What change should I make so that my application runs in my mobile also. Please do let me know. i am struggling from long time. The IP address which I have used in my code is "http://10.0.2.2/Myphpfile".

Please help me and let me know how can I make my application run on mobile using the same server. Server has been started in my PC. i am not using Wi-Fi. My system has a broadband connection and My mobile use network providers internet.

keshav kowshik
  • 2,354
  • 4
  • 22
  • 45
  • If you need users to connect to your PC you'll need to give permissions to Apache, or whatever server you have. If you just need to connect your mobile to your localhost server for testing purposes, connect mobile phone to the same Wifi spot or use a VPN to join mobile network with your Wifi. – Nacho Ramos Sánchez May 29 '15 at 11:08
  • I need users to connect to the system server. Can you please let me know where should I give permission to apache? for giving access to my server to other devices – keshav kowshik May 29 '15 at 11:10
  • 1
    Your phone and server must be on same network i.e same wifi network or connected through wifi hotspot in your mobile. And in place of 10.0.2.2 enter the ip address of your server. – Alok Nair May 29 '15 at 11:10
  • If you are under the same wifi router, then you can run the server in the PC and from mobile use the ip address of PC and connect. – Pavandroid May 29 '15 at 11:11
  • If your pc has a static STATIC ip, then you can connect using that ip from phone on any network provided your server is online and running. – Alok Nair May 29 '15 at 11:12
  • @Keshav Take a look at this http://stackoverflow.com/questions/16745475/how-to-point-my-localhost-to-a-public-ip-address and this https://managewp.com/how-to-access-a-local-website-from-internet-with-port-forwarding. You can purchase some dedicated server too. – Nacho Ramos Sánchez May 29 '15 at 11:12
  • Ok thank you all for your suggestions. To use the same server in mobile connecting the system, mobile to the same Wi-Fi is a must right? – keshav kowshik May 29 '15 at 11:16
  • @Keshav The thing is that you can access to your PC from devices that are connected to the same WIFI by using your private IP in that net. For people to connect to your PC, you will need a Puclic IP and a well configured server. Or, as I said before, purchase a dedicated server (some of them are free for sometime, free with limitations etc.) – Nacho Ramos Sánchez May 29 '15 at 11:18
  • @NachoRamosSánchez Thanks a lot for the suggestion. I will try to buy a dedicated server but for now Can I connect my mobile and my computer to the server by using same Wi-Fi. I did not understand the private IP thing, Can you please explain what is that private IP? where will i get that? Sorry I am not aware of all these. trying it first time. – keshav kowshik May 29 '15 at 11:22
  • @Keshav When you are connected to some net, all the devices in that net have a private IP `(example of PC format: 192.168.X.XXXX)`. This IP is only useful inside your net, for router/switcher/whatever to send/receive packages from the devices. These devices connected to the same spot can be connected between them by this Private IP (check Private IPs executing the command `ipconfig` in `CMD` in Windows). But when you need to connect to the global net (Internet) devices have to use a unique and Public IP, to be able to connect between them. Check Public IPs in: https://www.whatismyip.com/ – Nacho Ramos Sánchez May 29 '15 at 11:30
  • @NachoRamosSánchez Ok. Thanks a lot for all your help. – keshav kowshik May 29 '15 at 11:35

0 Answers0