Skip to content Skip to sidebar Skip to footer

Cordova-plugin-network-information On Android Return Connection.type = None Even If There Is 4g Connection

There is a problem with Cordova-plugin-network-information on Android. Even if there is a 4G connection, sometimes, when I resume the app from the background and I check connection

Solution 1:

This is the workaround I'm currently using for this issue:

document.addEventListener("resume", function(){
    navigator.connection.getInfo(function(type){
        navigator.connection.type = type;
    });
}, false);

See CB-14132 for an explanation of why.

Solution 2:

Try to use

document.addEventListener("deviceready", onDeviceReady, false);
        function onDeviceReady() {
             if(navigator.onLine) {
                 alert("Internet Connect");
                  }else {
                       alert("No Internet");
                  }
        }

Post a Comment for "Cordova-plugin-network-information On Android Return Connection.type = None Even If There Is 4g Connection"