Hi All… Have you tried Network status
steps which I followed using Ionic 2 to know whether you are online or offline
- install
$ ionic cordova plugin add cordova-plugin-network-information
$ npm install --save @ionic-native/network
import { Network } from '@ionic-native/network';
constructor( private network: Network ){
let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
this.events.publish('network:online', false);
this.online = false;
console.log('network was disconnected :-(');
let alert = this.alertCtrl.create({
title: 'Network was disconnected :-(',
subTitle: 'Please check your connection. And try again',
buttons: ['OK']
});
alert.present();
});
}
It firing twice Is anyone have solution for this and onConnect() is firing one time only
and I have checked this website
Ionic network doc
ampersandacademy
stackoverflow
Ionic forum
github
Please give me a solution if u solved means and I have ref websites please don’t suggest which I have already mentioned.
Thanks in advance