Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic mobile browser testing is not working

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.

like image 933
andreaspfr Avatar asked Apr 09 '15 20:04

andreaspfr


People also ask

How do I test an ionic app on my phone?

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.


2 Answers

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.

like image 105
Federico Hernández Avatar answered Oct 12 '22 03:10

Federico Hernández


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.

like image 20
RiaanJ Avatar answered Oct 12 '22 01:10

RiaanJ