The following logs out only when I have WiFi on. On 4g or any mobile internet type it doesn't. Doesn't seem so reliable. Any ideas for a better detection of online/offline state?
$rootScope.$on( '$cordovaNetwork:online', function ( event, networkState ) {
console.log( "Phone is online" );
} );
This works fine for me:
function isOnline(){
return !(Connection.NONE==navigator.connection.type);
}
I hope this helps you!