Biba Biba
Biba Biba

Reputation: 33

How can i check the connection off/on using ionic3

with what i can replace " Network.connection"? it's no more valid !! please i need help

import { Network } from '@ionic-native/network';
isOnline(): boolean {
 if(this.onDevice && Network){
 return Network.connection!== Connection.NONE;
} else {
  return navigator.onLine; 
}
}

Upvotes: 0

Views: 61

Answers (1)

Thomas
Thomas

Reputation: 2560

Check the documentation for the plugin: https://ionicframework.com/docs/native/network/

But in your case it seems to work with

return this.network.type != 'none';

After injecting the plugin of course.

Upvotes: 1

Related Questions