Skip to content

Commit

Permalink
fix(android): Send a "none" status if the device has no active networ…
Browse files Browse the repository at this point in the history
…k on launch (#96)
  • Loading branch information
matt-oakes authored May 18, 2019
1 parent 9c56876 commit c62cd8b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public NetworkCallbackConnectivityReceiver(ReactApplicationContext reactContext)
void register() {
try {
getConnectivityManager().registerDefaultNetworkCallback(mNetworkCallback);

// If we currently have no active network, we are not going to get a callback below, so we
// should manually send a "none" event
if (getConnectivityManager().getActiveNetwork() == null) {
updateAndSend();
}
} catch (SecurityException e) {
setNoNetworkPermission();
}
Expand Down

0 comments on commit c62cd8b

Please sign in to comment.