Skip to content

Commit

Permalink
docs(connectivity_plus): Update README for more clarity (#2770)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuberen committed Mar 30, 2024
1 parent 43f9a30 commit 8fb738e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/connectivity_plus/connectivity_plus/README.md
Expand Up @@ -14,7 +14,9 @@ This plugin allows Flutter apps to discover network connectivity types that can

> **Note**
>
> On Android, this does not guarantee connection to Internet. For instance, the app might have wifi access but it might be a VPN or a hotel WiFi > with no access.
> You should not rely on the current connectivity status to decide whether you can reliably make a network request. Always guard your app code against timeouts and errors that might come from the network layer.
> Connection type availability does not guarantee that there is an Internet access. For example, the plugin might return Wi-Fi connection type, but it might be a connection with no Internet access due to network requirements (like on hotel Wi-Fi networks where user often needs to go through a captive portal to authorize first).
>
## Platform Support

Expand Down Expand Up @@ -55,10 +57,6 @@ if (connectivityResult.contains(ConnectivityResult.mobile)) {
}
```

> **Note**
>
> You should not be using the current network status for deciding whether you can reliably make a network connection. Always guard your app code against timeouts and errors that might come from the network layer.
You can also listen for active connectivity types changes by subscribing to the stream
exposed by the plugin:

Expand All @@ -84,16 +82,13 @@ dispose() {

### Android

Connectivity changes are no longer communicated to Android apps in the background starting with Android O (8.0). You should always check for connectivity status when your app is resumed._ The broadcast is only useful when your application is in the foreground.
Connectivity changes are no longer communicated to Android apps in the background starting with Android O (8.0). You should always check for connectivity status when your app is resumed. The broadcast is only useful when your application is in the foreground.

### iOS

On iOS, the connectivity status might not update when WiFi status changes, this is a known issue that affects mainly simulators.

Starting on iOS 12, the implementation uses `NWPathMonitor` to obtain the enabled connectivity types.

We noticed that this observer can give multiple or unreliable results. For example, reporting connectivity "none" followed by connectivity "wifi" right after reconnecting.
On iOS simulators, the connectivity types stream might not update when Wi-Fi status changes. This is a known issue.

Starting with iOS 12, the implementation uses `NWPathMonitor` to obtain the enabled connectivity types. We noticed that this observer can give multiple or unreliable results. For example, reporting connectivity "none" followed by connectivity "wifi" right after reconnecting.
We recommend to use the `onConnectivityChanged` with this limitation in mind, as the method doesn't filter events, nor it ensures distinct values.

### Web
Expand Down

0 comments on commit 8fb738e

Please sign in to comment.