WifiManager.Maui
1.0.1
dotnet add package WifiManager.Maui --version 1.0.1
NuGet\Install-Package WifiManager.Maui -Version 1.0.1
<PackageReference Include="WifiManager.Maui" Version="1.0.1" />
paket add WifiManager.Maui --version 1.0.1
#r "nuget: WifiManager.Maui, 1.0.1"
// Install WifiManager.Maui as a Cake Addin
#addin nuget:?package=WifiManager.Maui&version=1.0.1
// Install WifiManager.Maui as a Cake Tool
#tool nuget:?package=WifiManager.Maui&version=1.0.1
Wifi Manager for MAUI
MAUI Wi-Fi Manager is comprehensive solution designed specifically for MAUI. This library empowers developers to effortlessly manage Wi-Fi networks within their cross-platform applications. With its intuitive APIs, you can seamlessly integrate Wi-Fi functionality, allowing users to connect to, add, and retrieve information about Wi-Fi networks with ease.
Features
Connect Wi-Fi with SSID and Password: Enable users to connect to Wi-Fi networks by providing the SSID and password.
Add a New Wi-Fi Network: Seamlessly add new Wi-Fi networks to the device.
Get Current Network Info: Retrieve information about the currently connected Wi-Fi network.
Disconnect Wi-Fi: Allow users to disconnect from a Wi-Fi network.
Open Wi-Fi Setting: Provide a quick way for users to access their device's Wi-Fi settings.
Getting started
Initialization
Before using the MAUI Wi-Fi Manager plugin in your application, it's essential to initialize it. Here's how to do it on different platforms:
Android
To use the MAUI Wi-Fi Manager on Android, you must initialize the plugin. Add the following code to your Android application:
WifiNetworkService.Init(this);
Android Permissions
<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 you request location before scanning Wi-Fi
iOS
Add wifi-info and HotspotConfiguration in Entitlements.plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.developer.networking.HotspotConfiguration</key>
<true/>
</dict>
</plist>
Request location permisson on info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>App want to access location to get ssid</string>
Example
PermissionStatus status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
if (status == PermissionStatus.Granted)
{
var response = await CrossWifiManager.Current.ScanWifiNetworks();
}
else
await DisplayAlert("No location permisson", "Please provide location permission", "OK");
Connect to Wi-Fi
To connect to a Wi-Fi network programmatically, use the ConnectWifi method. This method takes the SSID and password as parameters. Here's an example:
var response = await CrossWifiManager.Current.ConnectWifi(ssid, password);
The NetworkData class is defined as follows:
public class NetworkData
{
public int StausId { get; set; }
public string? Ssid { get; set; }
public int IpAddress { get; set; }
public string? GatewayAddress { get; set; }
public object? NativeObject { get; set; }
public object? Bssid { get; set; }
public object? SignalStrength { get; set; }
}
Scan available Wi-Fi (Not available on iOS)
You can available Wi-Fi networks using the ScanWifiNetworks method:
var response = await CrossWifiManager.Current.ScanWifiNetworks();
Get Wi-Fi info
You can retrieve information about the currently connected Wi-Fi network using the GetNetworkInfo method:
var response = await CrossWifiManager.Current.GetNetworkInfo();
Disconnect Wi-Fi
To disconnect from a Wi-Fi network, simply call the DisconnectWifi method with the SSID as a parameter:
CrossWifiManager.Current.DisconnectWifi(ssid);
Open Wi-Fi Setting
If you want to provide users with a convenient way to access their device's Wi-Fi settings, use the OpenWifiSetting method:
var response = await CrossWifiManager.Current.OpenWifiSetting();
I value your feedback! If you encounter any issues, have suggestions for improvement, or wish to report bugs, please open an issue on GitHub or GitLab repository
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.2 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.2 is compatible. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap10.0.17763 is compatible. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0-android34.0
- No dependencies.
-
net8.0-ios17.2
- No dependencies.
-
net8.0-maccatalyst17.2
- No dependencies.
-
net8.0-windows10.0.19041
- No dependencies.
-
UAP 10.0.17763
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.