Skip to content

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

@m-abs

Description

@m-abs

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;
        }
      }
    });

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions