Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13730

cordova-plugin-network-information return wrong connection status on Android

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • cordova@7.1.0
    • None
    • Windows 10, cordova-cli@7.1.0, cordova-android@6.4.0

    • Important

    Description

      There is a problem with cordova-plugin-network-information on Android. Even if there is internet connection, after the app is opened for a while, 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:

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

      Thanks
      Cristian

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ciossi Cristian Iossi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: