You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/connectivity/README.md
+30-8
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ dispose() {
50
50
}
51
51
```
52
52
53
-
You can get WIFI related information using:
53
+
You can get wi-fi related information using:
54
54
55
55
```dart
56
56
import 'package:connectivity/connectivity.dart';
@@ -60,17 +60,39 @@ var wifiIP = await (Connectivity().getWifiIP());network
60
60
var wifiName = await (Connectivity().getWifiName());wifi network
61
61
```
62
62
63
-
### Known Issues
63
+
### iOS 12
64
64
65
-
#### iOS 13
65
+
To use `.getWifiBSSID()` and `.getWifiName()` on iOS >= 12, the `Access WiFi information capability` in XCode must be enabled. Otherwise, both methods will return null.
66
66
67
-
The methods `.getWifiBSSID()` and `.getWifiName()` utilize the [CNCopyCurrentNetworkInfo](https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo) function on iOS.
67
+
### iOS 13
68
68
69
-
As of iOS 13, Apple announced that these APIs will no longer return valid information by default and will instead return the following:
70
-
> SSID: "Wi-Fi" or "WLAN" ("WLAN" will be returned for the China SKU)
71
-
> BSSID: "00:00:00:00:00:00"
69
+
The methods `.getWifiBSSID()` and `.getWifiName()` utilize the [`CNCopyCurrentNetworkInfo`](https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo) function on iOS.
72
70
73
-
You can follow issue [#37804](https://github.com/flutter/flutter/issues/37804) for the changes required to return valid SSID and BSSID values with iOS 13.
71
+
As of iOS 13, Apple announced that these APIs will no longer return valid information.
72
+
An app linked against iOS 12 or earlier receives pseudo-values such as:
73
+
74
+
* SSID: "Wi-Fi" or "WLAN" ("WLAN" will be returned for the China SKU).
75
+
76
+
* BSSID: "00:00:00:00:00:00"
77
+
78
+
An app linked against iOS 13 or later receives `null`.
79
+
80
+
The `CNCopyCurrentNetworkInfo` will work for Apps that:
81
+
82
+
* The app uses Core Location, and has the user’s authorization to use location information.
83
+
84
+
* The app uses the NEHotspotConfiguration API to configure the current Wi-Fi network.
85
+
86
+
* The app has active VPN configurations installed.
87
+
88
+
If your app falls into the last two categories, it will work as it is. If your app doesn't fall into the last two categories,
89
+
and you still need to access the wifi information, you should request user's authorization to use location information.
90
+
91
+
There is a helper method provided in this plugin to request the location authorization: `requestLocationServiceAuthorization`.
92
+
To request location authorization, make sure to add the following keys to your _Info.plist_ file, located in `<project root>/ios/Runner/Info.plist`:
93
+
94
+
*`NSLocationAlwaysAndWhenInUseUsageDescription` - describe why the app needs access to the user’s location information all the time (foreground and background). This is called _Privacy - Location Always and When In Use Usage Description_ in the visual editor.
95
+
*`NSLocationWhenInUseUsageDescription` - describe why the app needs access to the user’s location information when the app is running in the foreground. This is called _Privacy - Location When In Use Usage Description_ in the visual editor.
0 commit comments