Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229111

How to Check Network Connection on Every Page

$
0
0

@yashwanth493 i used this method but didn’t work

platform.ready().then(() => {
			if (platform.is('cordova')) {

				let connectSubscription = this.network.onConnect().subscribe(() => {
					console.log("Connected Chers");

					this.navChild.pop();

					this.toast.create({
						message: 'Network Connected',
						duration: 300
					}).present();
				});

				connectSubscription.unsubscribe();

				let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
					console.log("Connected Cry");

					this.navChild.push(NetworkCheckPage);

					this.toast.create({
						message: 'Network Disconnected',
						duration: 3000
					}).present();

				})
				disconnectSubscription.unsubscribe();

			}
		});


Viewing all articles
Browse latest Browse all 229111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>