Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: NetworkCallbackConnectivityReceiver does not report "none" status correctly #44

Closed
matt-oakes opened this issue Apr 5, 2019 · 3 comments · Fixed by #70
Closed
Labels
android Issues related to Android bug Something isn't working good first issue Good for newcomers help wanted Issues that you can help with released

Comments

@matt-oakes
Copy link
Collaborator

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 3.03 GB / 32.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 25.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4907809
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.2 => 0.59.2
    npmGlobalPackages:
      react-native-cli: 2.0.1

Platforms

Android

Versions

  • Android: 24+ (N and above)
  • iOS: NA
  • react-native-netinfo: Any
  • react-native: Any
  • react: Any

Description

The NetworkCallbackConnectivityReceiver class does not correctly handle the none case. It should set connectionType to CONNECTION_TYPE_NONE when mNetworkCapabilities is null. This will match the behaviour of iOS and older versions of Android.

Reproducible Demo

https://github.com/matt-oakes/net-info-test

@powdahound
Copy link
Contributor

powdahound commented Apr 25, 2019

@matt-oakes Made this change and it works well with manual testing (see notification above). Any plans for real tests of the Android implementation here? Feels wrong to submit a test-free PR. :)

@matt-oakes
Copy link
Collaborator Author

@powdahound Thanks for that! Feel free to submit a PR. I agree that it's strange to not have tests, but it's currently pretty hard to test this with the way that Detox is built. I have some ideas for the future on how to improve that (basically allow direct access to the adb command to allow you to do anything you like with the device).

@react-native-community-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 2.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issues related to Android bug Something isn't working good first issue Good for newcomers help wanted Issues that you can help with released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants