-
Notifications
You must be signed in to change notification settings - Fork 392
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
Use ConnectivityManager instead of ConnectivityManagerCompat #509
Conversation
ReactNativeNetInfo_minSdkVersion=16 https://developer.android.com/training/monitoring-device-state/connectivity-status-type#java Note: If your app needs to support Android 4.0 (API level 15) and lower, use ConnectivityManagerCompat.isActiveNetworkMetered instead of ConnectivityManager.isActiveNetworkMetered().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I verified that there is no case where react-native for android will be targetting API 15 or below, as it has always been a minSdkVersion of 16: https://github.com/facebook/react-native/blame/5017b86b525e3ef6023f0f8a88e6fd1cf98024e0/local-cli/templates/HelloWorld/android/app/build.gradle
I had some comments on further cleaning and null safety - curious for your thoughts there
Finally - I'm going to put this in the queue behind #500 which is about to merge, just in case they both perturbed the build.gradle, this PR should take the conflict since that has been outstanding longer
android/src/main/java/com/reactnativecommunity/netinfo/ConnectivityReceiver.java
Outdated
Show resolved
Hide resolved
no Co-authored-by: Mike Hardy <github@mikehardy.net>
…ivityReceiver.java Check for null connectivity manager before dereferencing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now and I really appreciate the build simplification of not needing the compat interface and thus being able to shed it's dependency
## [6.0.4](v6.0.3...v6.0.4) (2021-10-22) ### Bug Fixes * **android:** use ConnectivityManager directly, drop androidx dependency ([#509](#509)) ([2569f56](2569f56))
🎉 This PR is included in version 6.0.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
ReactNativeNetInfo_minSdkVersion=16
https://developer.android.com/training/monitoring-device-state/connectivity-status-type#java
Note: If your app needs to support Android 4.0 (API level 15) and lower, use ConnectivityManagerCompat.isActiveNetworkMetered instead of ConnectivityManager.isActiveNetworkMetered().
Overview
Test Plan