How to automatically reload data on network connect ? I can check network status on both disconnect and connect, but unable to reload data on network connection?

I am using this code to detect network -

import { Injectable } from ‘@angular/core’;
import { AlertController, Platform } from ‘ionic-angular’;
import { Network } from ‘ionic-native’;

declare var Connection: any;
declare var cordova: any;

@Injectable()
export class NetworkService {

onDevice: boolean;

constructor(public platform: Platform, public alertCtrl: AlertController) {
}

noConnection = (): boolean => {
return Network.type === Connection.NONE;
}

private showSettings() {
if (cordova.plugins.diagnostic.switchToWifiSettings) {
cordova.plugins.diagnostic.switchToWifiSettings();
} else {
cordova.plugins.diagnostic.switchToSettings();
}
}
showNetworkAlert() {
let networkAlert = this.alertCtrl.create({
title: ‘No Internet Connection’,
message: ‘Please check your internet connection and open app again.’,
buttons: [
{
text: ‘Cancel’,
handler: () => { }
},
{
text: ‘Open Settings’,
handler: () => {
networkAlert.dismiss().then(() => {
this.showSettings();
})
}
}
]
});
networkAlert.present();
}
}

Check network cordova plugin, there’s a good example.