How to Check Network Connection

Please suggest the best way to achieve

use the below method in your app.components.ts

 if ( == "none") {

        .subscribe(e => this.checkNetwork(e.type), err => console.error(err));

  checkNetwork(e) {
    if (e == "online") {
      this.isOnline = true;
    } else {

      this.isOnline = false;

check network type hat u ll get first… if it is online then the internet is turned on else it will be offline

@yashwanth493 thanks for your precious time, will you please brief, i am new in Ionic.

Thanks a lot

in this… when u get network type is none… here none means offline the call checkNetwork() this method…

take out this outside if condition put in else part and try

window.location.onLine this is a read only variable which shows whether you are in Online/offline based on this you can implement your functionality with network connection plugin from ionic .Hope this will help