@Vageesan wrote:
Hi,
I am using Ionic CLI 1.7.14 and cordova 5.4.1, I am trying check if the device has internet access.
But it is not working and routes to default page. Earlier it was working but after updating ionic, ngCordova it stopped working. Is there any toher fix other than rolling back to older version.The following is the code I use:
app.run(function($ionicPlatform, $ionicPopup, $cordovaNetwork, $cordovaDevice, $rootScope) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}// Not working
if(window.Connection) {
if(navigator.connection.type == Connection.NONE) {
$ionicPopup.alert({
title: "No Internet Connection",
content: "Sorry, no Internet connectivity detected. Please reconnect and try again."
})
.then(function(result) {
ionic.Platform.exitApp();
if(!result) {
ionic.Platform.exitApp();
}
});
}
}
});
});
Posts: 1
Participants: 1