Skip to content

Commit 60ab69f

Browse files
Try to fix: #64: working with the ConnectivityManager.NetworkCallback in case of Lollipop and above, but switching to unknown if type none in the onavailable callback.
1 parent acc02f2 commit 60ab69f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/android/NetworkManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,24 @@ private void registerLollipopAndAboveNetworkCallback() {
175175

176176
@Override
177177
public void onAvailable(Network network) {
178+
LOG.d(LOG_TAG, "In the on available: ");
178179
updateConnectionInfoIfWebViewNotNull(sockMan.getActiveNetworkInfo());
180+
181+
String connectionType = determineCurrentConnectionType();
182+
183+
if(TYPE_NONE.equals(connectionType)) {
184+
LOG.d(LOG_TAG, "ConnectionType none but in the onAvailable");
185+
LOG.d(LOG_TAG, "!!! Switching to unknown, onAvailable states there is a connectivity.");
186+
sendUpdate(TYPE_UNKNOWN);
187+
}
188+
LOG.d(LOG_TAG, "End the on available: ");
179189
}
180190

181191
@Override
182192
public void onLost(Network network) {
193+
LOG.d(LOG_TAG, "In the on lost: ");
183194
updateConnectionInfoIfWebViewNotNull(sockMan.getActiveNetworkInfo());
195+
LOG.d(LOG_TAG, "End the on lost: ");
184196
}
185197
};
186198
sockMan.registerNetworkCallback(builder.build(), lollipopAndAboveNetworkCallback);

0 commit comments

Comments
 (0)