Skip to content

Commit e6f542d

Browse files
berickson1facebook-github-bot
authored andcommitted
When subscribing for network connectivity broadcasts, also query the value so we always have the most up-to-date value.
Summary: We've seen cases (based on logs) where NetInfo is reporting no connectivity, but network requests still work. This will keep status up to date after app foreground <-> backgrounds, since we don't listen to broadcasts when backgrounded. This is rather difficult to test given we haven't nailed an internal repro (evidence is solely based on device/app logs). Testing has been done to ensure that there are no behavioural changes on devices that were previously working (no regressions). Closes #15558 Differential Revision: D6264708 Pulled By: hramos fbshipit-source-id: 1648cadb59949103d0a595614b38024ec9236719
1 parent cb6ec7c commit e6f542d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/netinfo/NetInfoModule.java

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ private void registerReceiver() {
124124
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
125125
getReactApplicationContext().registerReceiver(mConnectivityBroadcastReceiver, filter);
126126
mConnectivityBroadcastReceiver.setRegistered(true);
127+
updateAndSendConnectionType();
127128
}
128129

129130
private void unregisterReceiver() {

0 commit comments

Comments
 (0)