Ionic apps that are launched without an internet connection will result in a permanent blank screen after the launch image. The whole app has to be restarted after a network connection is established. There is a handler for this using the following code in the app.js file:
https://www.thepolyglotdeveloper.com/...
code
var myApp = angular.module('myapp', ['ionic'])
.run(function($ionicPlatform, $ionicPopup) {
$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();
}
});
}
}
});
});
/code
It seems that I need to add that to the following section of my app.js file. I've tried as many ways as I can but can't figure out how/where exactly to add it?
code
var APP = angular.module(window.__APPLICATION_NAME, ['ApperyioModule', "ionic", "uiGmapgoogle-maps"]).config(["$routeProvider", '$controllerProvider', '$provide', '$locationProvider', '$compileProvider', '$filterProvider', 'uiGmapGoogleMapApiProvider', Configuration]).run(["Apperyio", "User", "$location", "$ionicPlatform", RUN]);
/code
Is there a way that we can implement this so that our ionic apps don't just freeze after the launch screen when there is no internet connection? Thank you