I have installed cordova-plugin-network-information using CLI for a ionic project. I could see the plugin is referred in android.json file in root folder of project and also in cordova_plugin.js in android platform folder.
cordova_plugin.js:
{
"id": "cordova-plugin-network-information.network",
"file": "plugins/cordova-plugin-network-information/www/network.js",
"pluginId": "cordova-plugin-network-information",
"clobbers": [
"navigator.connection",
"navigator.network.connection"
]
}
android.json:
"cordova-plugin-network-information": {
"PACKAGE_NAME": "com.ionicframework.fts1243245"
}
I tried calling window.Connection in ionic ready as:
$ionicPlatform.ready(function() {
if(window.Connection){
if(navigator.connection.type == Connection.NONE){
$ionicPopup.confirm({
title:"Internet Disconnected",
content:"The internet is disconnected on your device."
})
.then(function(result){
if(!result){
ionic.Platform.exitApp();
}else{
ionic.Platform.exitApp();
}
});
}
}
}
But, window.Connection return undefined
Can anyone please let me know what went wrong?