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

Use ConnectivityManager instead of ConnectivityManagerCompat #509

Merged
merged 7 commits into from Oct 22, 2021

Conversation

Willham12
Copy link
Contributor

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

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().
Copy link
Contributor

@mikehardy mikehardy left a 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/build.gradle Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@mikehardy mikehardy added android Issues related to Android changes requested labels Oct 22, 2021
Willham12 and others added 2 commits October 22, 2021 16:56
no

Co-authored-by: Mike Hardy <github@mikehardy.net>
…ivityReceiver.java


Check for null connectivity manager before dereferencing
Copy link
Contributor

@mikehardy mikehardy left a 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

@mikehardy mikehardy merged commit 2569f56 into react-native-netinfo:master Oct 22, 2021
github-actions bot pushed a commit that referenced this pull request Oct 22, 2021
## [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))
@matt-oakes
Copy link
Collaborator

🎉 This PR is included in version 6.0.4 🎉

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 released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants