FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bug: connectivity module always return undefined on android <= 4.4 · Issue #3098 · NativeScript/NativeScript · GitHub

Bug: connectivity module always return undefined on android <= 4.4 #3098

Description

Which platform(s) does your issue occur on?

Android <= 4.4 (Tested on 4.2.2 and 4.4.2 with emulator)
Android >= 5.0 works as expected (at least all the versions I've tested on)

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.3.0
  • Cross-platform modules: 2.3.0
  • Runtime(s): tns-android@2.3.0
  • Plugin(s):

Please tell us how to recreate the issue in as much detail as possible.

*Steps to reproduce: *

  • Setup a project, enable android.permission.ACCESS_NETWORK_STATE in app/App_Resources/Android/AndroidManifest.xml
  • Import the connectivity module;
  • Setup and connectivity.startMonitoring or call connectivity.getConnectionType()
  • On older androids (I tested on an emulator running 4.2.2 and 4.4.2, CPU: Google APIs Intel Atom x86) connectivity status is always undefined.

Expected result:
Connection status on both older and newer android.

Is there code involved? If so, please share the minimal amount of code needed to recreate the

problem.

I've made a simple example here:
https://github.com/m-abs/ns-debugging/tree/connectivity-issue

    connectivity.startMonitoring((status) => {
      console.log(status);
      switch (status) {
        case connectivity.connectionType.mobile: {
          this.networkStatus = 'MOBILE';
          break;
        }
        case connectivity.connectionType.wifi: {
          this.networkStatus = 'WIFI';
          break;
        }
        case connectivity.connectionType.none: {
          this.networkStatus = 'OFFLINE';
          break;
        }
        default: {
          this.networkStatus = 'UNKNOWN';
          break;
        }
      }
    });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL