-1

I'm working with a nodejs, mysql, Android stack.

I want to test my android app on real device and connected my laptop and mobile on same WIFI network and specified the IP address in URL as I'm using Volley library

url is: http://ipaddress:8080 8080 is nodejs server port

But when i run my android app it does not run on nodejs server.No request is processed on nodejs server though request is sent from android side

I have tried many links but none of them worked. Any help is appreciated

TidyDev
  • 3,470
  • 9
  • 29
  • 51
primo
  • 1,340
  • 3
  • 12
  • 40
  • Is your device and server in same network? – Sagar May 29 '18 at 06:57
  • yes my device and server laptop is connected to same WIFI network – primo May 29 '18 at 06:59
  • Have you tried disabling firewall? – Sagar May 29 '18 at 07:00
  • no i didn't.... – primo May 29 '18 at 07:05
  • Try disabling firewall and then check if connection works. – Sagar May 29 '18 at 07:06
  • Also check if Chrome browser can access the URL. – Sagar May 29 '18 at 07:06
  • disabling firewall doesn't works and chrome browser is not able to access URL.It is not navigating to phpmyadmin instead it is showing **cannot GET/** – primo May 29 '18 at 07:12
  • 1
    You should resolve your server issues first. And once you will be able to access your server at least from chrome browser, then you should try your app. – Vladyslav Matviienko May 29 '18 at 07:18
  • @primo looks like issue with your server. check if its working properly on your Laptop first – Sagar May 29 '18 at 07:19
  • i tried using different method connecting laptop to mobile's WIFI hotspot and it worked for me and when i run its URL on browser then also it is showing me same error ** cannot GET/**..so,this might not be the issue as on same 8080 port i am accessing its html side also – primo May 29 '18 at 07:27
  • `It is not navigating to phpmyadmin ` ??? Why should it navigate to phpadmin? It should connect with your node.js server. You should use a Chrome or other browser running on your Android device to test. It is unclear which ip-address you tried. – greenapps May 29 '18 at 08:34

1 Answers1

0
I have the answer to my question
I tried the following link and it worked for me
https://stackoverflow.com/a/17603378/8101634

what it states is.
1) Connecting android device through USB cable to laptop
2) Switching USB tethering on android device
3) Go to network and sharing center.
4) It will show you the device and click on it.
5) Click on details
6) Take the Ipv4 address from there and use it as URL in android app
7) Re-run your android application

It works
primo
  • 1,340
  • 3
  • 12
  • 40
  • Bad solution. You should not need a cable. Or make the Android device a hotspot. Just using the ip of your pc should do it. – greenapps May 29 '18 at 08:33
  • if it should not be connected using USB cable then how will i launch my application on my device.. – primo May 29 '18 at 09:14
  • Well during development and if your IDE wants to install your apk you need a cable indeed. But then you should not start usb tethering. Just a normal wifi connection should do. If your apk runs then you dont wanna connect your phone the whole time to a pc is it? – greenapps May 29 '18 at 09:44
  • for sometime it will show proper data to me if i disconnect USB from pc after application launch.. – primo May 29 '18 at 09:46
  • and i used usb tethering as my both devices were connected on same WIFI network but then also request was not reaching upto the node server – primo May 29 '18 at 09:48
  • You should try to resolve that problem using wifi. First try a browser on your pc. If that goes ok a browser on your device. Tell us which ip exactly you use when using a browser on your device. – greenapps May 29 '18 at 09:52
  • i use 192.168.x.x:8080 – primo May 29 '18 at 09:53
  • And that is the ip of ... the server ?? Please be exact. You should not use the ip of the client. You can safely publish the whole ip as millions of computers in this world have that ip. – greenapps May 29 '18 at 09:54