I try to use mobile browser testing with ionic. I'm connected in the same Wifi as my iPhone and checked my IP-Address with the following command: ifconfig |grep inet
. When I'm running ionic server with the command ionic serve
I'm not able to open my ionic app on my iPhone using my IP-Address and the specified port from ionic. Do I have to enable something else on my machine? I also tried different ports without any success.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
This answer may be late, but I hope it is useful to anybody who has the same problem in the future. What solved this issue for me was to put the following command: ionic address
and select the ip of my dev server(in my case 192.168.0.2
) instead of the localhost option. Now when I run ionic serve
I can succesfully connect from the mobile browser.
I had a similar issue trying this using Windows 8.1 and Android. When I used http://localhost:8100/ it loaded correctly on my desktop version of Chrome but using my local IP address in the desktop browser i.e. 192.168.1.185:8100 I got a "Connection Refused" error. Needless to say this didn't work in Chrome on my mobile device either.
What solved this issue was using Port Forwarding as per https://developer.chrome.com/devtools/docs/remote-debugging#port-forwarding
In this way I could open the site using "localhost:8100" and not the IP address on my mobile device in Chrome and the site loaded and debugged correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With