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

fix(android) Connectivity reporting none on resume #9915

Merged
merged 2 commits into from
May 19, 2022

Conversation

jcassidyav
Copy link
Contributor

PR Checklist

What is the current behavior?

On some android phones, (Google Pixel 5 & Galaxy s20+ running android 12) the final state reported when subscribing to Connectivity.startMonitoring would report incorrectly report no connectivity.

This happened when the app was in the foreground, and the phone was locked and then unlocked ( i.e. hit power button)
This was because the call to the methods on ConnectivityManager.getActiveNetwork returned null, the documentation seems to suggest that calling any of the syncronus methods on ConnectivityManager is not advised during these callbacks.
https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback

What is the new behavior?

The new behaviour is to rely on the network capabilities passed to the callback to determine the status, or to report no connectivity when lost is triggered.

Fixes/Implements/Closes #[Issue Number].

@cla-bot cla-bot bot added the cla: yes label May 19, 2022
onCapabilitiesChanged(network: android.net.Network, networkCapabilities: android.net.NetworkCapabilities) {
console.log('NetworkCallbackImpl.onCapabilitiesChanged');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove the console.log ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know how I missed that, gone now.

@NathanWalker NathanWalker changed the base branch from master to alpha May 19, 2022 22:12
@NathanWalker NathanWalker merged commit 8dad6ed into NativeScript:alpha May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants