Skip to content

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

Closed

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

Activity

  1. self-assigned this
    on Nov 15, 2016
  2. tsonevn commented on Nov 15, 2016

    @tsonevn
    Contributor

    Hi @m-abs,
    Thank you for reporting this issue and for providing sample project.

    I was able to reproduce this behavior on emulator with API level 18 and 17. Regarding to that I could not reproduce this problem on real device. We will research further this issue and will provide additional information. In the mean time could you check, whether you will reproduce this problem on real device?

    Regards,
    @tsonevn

  3. self-assigned this
    on Nov 15, 2016
  4. m-abs commented on Nov 15, 2016

    @m-abs
    ContributorAuthor

    I'll have to get back to you, when I've found a hardware device with older android version.

  5. m-abs commented on Nov 16, 2016

    @m-abs
    ContributorAuthor

    Hi @tsonevn
    Sorry, I can't test on a real device with Android4.2/API17, the oldest device I've access to right now runs Android 4.4.

    But if the problem only occures on an emulator it's only a minor annoyance for us.

  6. added a commit that references this issue on Nov 16, 2016
    4fff9cd
  7. hamorphis commented on Nov 16, 2016

    @hamorphis
    Contributor

    @m-abs The bug has been fixed: #3105

  8. added this to the 2.5.0 milestone on Nov 17, 2016
  9. lock commented on Aug 29, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  10. locked and limited conversation to collaborators on Aug 29, 2019
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