The Wi-Fi Manager for .NET MAUI is a simple and powerful library that helps you manage Wi-Fi networks in your cross-platform apps. With this library, you can easily connect to Wi-Fi networks, retrieve network information, and provide quick access to Wi-Fi and wireless settings.
Platform | Supported | Notes |
---|---|---|
Android | ✅ | |
iOS | ✅ | |
Windows | ✅ | |
Mac | ❌ | |
Tizen | ❌ |
- Connect to Wi-Fi: Connect to Wi-Fi networks using SSID and password.
- Get Network Info: View details about the currently connected network.
- Disconnect Wi-Fi: Disconnect from a specific Wi-Fi network.
- Open Wi-Fi Settings: Provide quick access to device Wi-Fi settings.
- Open Wireless Settings: Provide quick access to device wireless settings.
Before using the library, make sure to initialize it properly:
Add the following to your Android app initialization:
WifiNetworkService.Init(this);
Also, include these permissions in your AndroidManifest.xml
file:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Make sure to request location permissions before scanning for Wi-Fi.
Add the following to your Entitlements.plist
:
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.developer.networking.HotspotConfiguration</key>
<true/>
In Info.plist
, request location permissions:
<key>NSLocationWhenInUseUsageDescription</key>
<string>The app needs location access to detect Wi-Fi networks.</string>
To connect to a Wi-Fi network:
var response = await CrossWifiManager.Current.ConnectWifi("your-SSID", "your-password");
To get a list of available Wi-Fi networks (Android & Windows only):
var response = await CrossWifiManager.Current.ScanWifiNetworks();
To retrieve details of the currently connected Wi-Fi network:
var response = await CrossWifiManager.Current.GetNetworkInfo();
To disconnect from a Wi-Fi network:
await CrossWifiManager.Current.DisconnectWifi("your-SSID");
To open the device's wireless settings:
await CrossWifiManager.Current.OpenWirelessSetting();
Note: On iOS, this opens the app's settings instead of wireless settings.
To provide quick access to Wi-Fi settings:
await CrossWifiManager.Current.OpenWifiSetting();
Note: On iOS, this opens the app's settings instead of Wi-Fi settings.
Feature | Android | iOS | Windows | Notes |
---|---|---|---|---|
Connect to Wi-Fi | ✅ | ✅ | ✅ | Supported on all platforms. |
Get Current Network Info | ✅ | ✅ | ✅ | Supported on all platforms. |
Disconnect Wi-Fi | ✅ | ✅ | ✅ | Supported on all platforms. |
Scan for Available Wi-Fi Networks | ✅ | ❌ | ✅ | Not supported on iOS. |
Open Wireless Settings | ✅ | ✅* | ✅ | *Opens app settings on iOS. |
Open Wi-Fi Settings | ✅ | ✅* | ✅ | *Opens app settings on iOS. |
If you encounter any issues or have suggestions, please open an issue on the project's GitHub repository.
contributions to this project are always welcomed. To ensure a smooth collaboration, please follow these guidelines:
develop
: This is the development branch where all new features and bug fixes should be merged. Always branch out fromdevelop
for your work.main
: This is the release branch containing production-ready code. Only merge intomain
after thorough testing and reviews.
Create a new issue using one of the provided issue templates. These templates ensure we have all the necessary information to understand and address the issue effectively.
This project is licensed under the MIT License. See the LICENSE file for details.