Why is platform.ready not firing in the below Ionic 2 code?
import { Component } from '@angular/core';
import { Network } from '@ionic-native/network';
import { NavController, AlertController, Platform } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController,
private network: Network,
private platform: Platform) {
var networkState;
// breakpoint hits on platform.ready
platform.ready().then(() => {
// breakpoint NOT hit on the below line
networkState = network.type;
var test = 'here';
});
}
}
Below is debugger info
deviceready has not fired after 5 seconds.
Channel not fired: onNativeReady
Channel not fired: onCordovaReady
Channel not fired: onCordovaSimulateReady
Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
ionViewDidLoad FriendsPage
ionViewDidLoad LocationsPage
I uninstalled and reinstalled all plugins (cordova plugin remove/add pluginName). Below is my plugin list:
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 “Keyboard”
I also updated all packages (remove the existing node_modules directory, and then run npm install):
Package
@angular/common 2.2.1
@angular/compiler 2.2.1
@angular/compiler-cli 2.2.1
@angular/core 2.2.1
@angular/forms 2.2.1
@angular/http 2.2.1
@angular/platform-browser 2.2.1
@angular/platform-browser-dynamic 2.2.1
@angular/platform-server 2.2.1
@ionic/app-scripts 1.0.0
@ionic/storage 1.1.7
ionic-angular 2.0.0
ionic-native 2.4.1
sw-toolbox 3.4.0
typescript 2.0.9
zone.js 0.6.26
Please let me know how to fix this.
Thanks.