Can't get the ionic app to work (under development) if you turn off Wi-Fi

So, during development, I turned off Wi-Fi, and then the ionic application does not work in the Android device / emulator.

But when I turn off Wi-Fi with the released and signed apk file for the Android app, everything is fine.

I need my application to do something when the Internet connection is disconnected, to do something:

   if(window.Connection) {
        if(navigator.connection.type == Connection.NONE) {
            //doSomething();
        }
      }

But since the application does not run on the emulator or device, if I turn off Wi-Fi, I can’t check if the code worked without the need to create an apk package, which is very time-consuming. How can I make it work even if I turn off Wi-Fi?

I get an error message:

enter image description here

+1
2

ionic run android -l -c . , ionic serve. , , , . ionic run android , file:///android_asset/www/.

-l -c: l , , . c , , . , . , , .

. cordova plugins .. . -l -c .

+4

. ionic run android -l -c, ionic run android , , livereload -l,

0

Source: https://habr.com/ru/post/1607679/


All Articles