title: ionic2: network connectivity check during splash screen
body: <p>I've been trying hard to figure out how to check for network connectivity while the splashscreen is being displayed.I've searched for the code in many places but most of those articles are outdated.
  I followed the tutorial that's mentioned here:<a href="https://www.thepolyglotdeveloper.com/2016/01/determine-network-availability-in-an-ionic-2-mobile-app/" rel="nofollow noreferrer">https://www.thepolyglotdeveloper.com/2016/01/determine-network-availability-in-an-ionic-2-mobile-app/</a></p>
  
  <p>But then I found out that Network.connection is deprecated and has been replaced by Network.type on the ionic2 website.
  So I've replaced the word connection with Network.type everywhere.
  So I checked out the ionic2 website and found this code which I included in the home.ts file.</p>
  
  <pre><code>    import {Network} from 'ionic-native';
      checkConnection() {
      //console.log("entrou");
      //console.log(Network);
      let disconnectSubscription = Network.onDisconnect().subscribe(() =&gt; {
        console.log('network was disconnected :-( ')
      });
      disconnectSubscription.unsubscribe();
      console.log("watch network");
      console.log("Conexao" + Network.type);
      let connectSubscription = Network.onConnect().subscribe(() =&gt; {
        console.log('network connected!');
        setTimeout(() =&gt; {
          console.log('network status');
          console.log(Network.type); 
          if (Network.type === 'WIFI') {
            console.log('we got a wifi connection, woohoo!');
           }
        }, 3000);
      });
      console.log("Sub" + connectSubscription);
      connectSubscription.unsubscribe();
    }
  </code></pre>
  
  <p>here is my home.html file</p>
  
  <pre><code>`&lt;ion-header&gt;
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;Home&lt;/ion-title&gt;
    &lt;/ion-navbar&gt;
  &lt;/ion-header&gt;
  &lt;ion-content padding&gt;
      &lt;button ion-buttton (click)="checkConnection()"&gt;Check Network&lt;/button&gt;
  &lt;/ion-content&gt;`
  </code></pre>
  
  <p>I tried implementing the same code but doesn't work.</p>
  
  <p>I want to know what is the exact code that I can use ?</p>
  
  <p>What is that  I need to import to use this code if it is the right one?</p>
  
  <p>Also I want to know how to run it during the splashscreen ?<a href="https://i.stack.imgur.com/mN8uw.png" rel="nofollow noreferrer"></a>
  On the console I found these errors</p>
  
  <p>"Native: tried calling Network.type, but the Network plugin is not installed.
  Network plugin: 'ionic plugin add cordova-plugin-network-information'</p>
  
  <p>But i've already installed the required plugin following that above command.I also installed "npm install ionic-native".</p>
  
  <p>I reinstalled them on seeing this error but this still persists.</p>