mirror of
https://gitee.com/shuto/cordova-plugin-network-information.git
synced 2025-01-18 21:52:48 +08:00
Try to fix: https://github.com/apache/cordova-plugin-network-information/issues/64: working with the ConnectivityManager.NetworkCallback in case of Lollipop and above, but switching to unknown if type none in the onavailable callback.
This commit is contained in:
parent
acc02f2981
commit
60ab69fe58
@ -175,12 +175,24 @@ public class NetworkManager extends CordovaPlugin {
|
||||
|
||||
@Override
|
||||
public void onAvailable(Network network) {
|
||||
LOG.d(LOG_TAG, "In the on available: ");
|
||||
updateConnectionInfoIfWebViewNotNull(sockMan.getActiveNetworkInfo());
|
||||
|
||||
String connectionType = determineCurrentConnectionType();
|
||||
|
||||
if(TYPE_NONE.equals(connectionType)) {
|
||||
LOG.d(LOG_TAG, "ConnectionType none but in the onAvailable");
|
||||
LOG.d(LOG_TAG, "!!! Switching to unknown, onAvailable states there is a connectivity.");
|
||||
sendUpdate(TYPE_UNKNOWN);
|
||||
}
|
||||
LOG.d(LOG_TAG, "End the on available: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLost(Network network) {
|
||||
LOG.d(LOG_TAG, "In the on lost: ");
|
||||
updateConnectionInfoIfWebViewNotNull(sockMan.getActiveNetworkInfo());
|
||||
LOG.d(LOG_TAG, "End the on lost: ");
|
||||
}
|
||||
};
|
||||
sockMan.registerNetworkCallback(builder.build(), lollipopAndAboveNetworkCallback);
|
||||
|
Loading…
Reference in New Issue
Block a user