You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Cristian Iossi (JIRA)" <ji...@apache.org> on 2018/01/04 13:23:00 UTC

[jira] [Created] (CB-13730) cordova-plugin-network-information return wrong connection status on Android

Cristian Iossi created CB-13730:
-----------------------------------

             Summary: cordova-plugin-network-information return wrong connection status on Android
                 Key: CB-13730
                 URL: https://issues.apache.org/jira/browse/CB-13730
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-network-information
    Affects Versions: cordova@7.1.0
         Environment: Windows 10, cordova-cli@7.1.0, cordova-android@6.4.0
            Reporter: Cristian Iossi


There is a problem with cordova-plugin-network-information on Android. Even if there is internet connection sometimes, when I resume the app from the background and I check connection with navigator.connection.type, it returns connection.type = NONE: I tried to do an ajax request to verify the connection, and it works, so there is connection. If I close and re-open the app it returns connection.type = 4G. I use cordova@7.1.0 and cordova-android@6.4.0.
My code to check the connection status is: 

{code:java}
function isOnline() {
    var networkState = navigator.connection.type;
    if (networkState !== Connection.NONE) {
        return true
    } else {
        return false
    }
}
{code}


Thanks
Cristian



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org