Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/connectivity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.3+4

* [Android] Updated logic to retrieve network info.

## 0.4.3+3

* Support for TYPE_MOBILE_HIPRI on Android.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@ public void onMethodCall(MethodCall call, Result result) {
}

private void handleCheck(MethodCall call, final Result result) {
result.success(checkNetworkType());
}

private String checkNetworkType() {
NetworkInfo info = manager.getActiveNetworkInfo();
if (info != null && info.isConnected()) {
result.success(getNetworkType(info.getType()));
return getNetworkType(info.getType());
} else {
result.success("none");
return "none";
}
}

Expand Down Expand Up @@ -154,14 +158,7 @@ private BroadcastReceiver createReceiver(final EventSink events) {
return new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
boolean isLost = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
if (isLost) {
events.success("none");
return;
}

int type = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, -1);
events.success(getNetworkType(type));
events.success(checkNetworkType());
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for discovering the state of the network (WiFi &
mobile/cellular) connectivity on Android and iOS.
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity
version: 0.4.3+3
version: 0.4.3+4

flutter:
plugin:
Expand Down