Skip to content
Shiny Controls v1.0 - The Ultra Control Suite for .NET MAUI & BlazorO...M...G!

Known Networks

A known network is one the device has saved and can rejoin without being handed the passphrase again. IWifiManager exposes three calls over them:

var known = await wifi.GetKnownNetworks(ct); // list
await wifi.Forget(id, ct); // delete one
await wifi.Connect(id, ct); // rejoin one
public sealed record KnownWifiNetwork
{
public required string Id { get; init; }
public required string Ssid { get; init; }
public WifiSecurity Security { get; init; }
public bool IsHidden { get; init; }
public bool AddedByThisApp { get; init; }
}

Id is opaque and issued by the platform. It is a NetworkManager connection UUID on Linux, a numeric network id on Android below API 29, and the SSID everywhere else. Round-trip it into Forget and Connect; do not parse it, construct it, or store it somewhere it might be read back on a different platform. If you need to find a network by name, match on Ssid.

The scope of “known” is not the same everywhere

Section titled “The scope of “known” is not the same everywhere”

This is the part that surprises people, so the API states it rather than papering over it.

What GetKnownNetworks() returns
iOS / Mac Catalyst Only the SSIDs your app configured through NEHotspotConfiguration
Android Only your app’s network suggestions and configurations
Windows Every profile on the machine
macOS The machine’s whole preferred-network list
Linux Every Wi-Fi profile NetworkManager holds

Neither iOS nor Android will show an app the networks the user saved — that is a deliberate privacy boundary, not a gap here. On a phone this list is empty until your own app has joined something with Remember left on, so do not build a “manage all my Wi-Fi networks” screen for mobile.

AddedByThisApp tells the two cases apart. It is always true on iOS, Mac Catalyst and Android, and always false on Windows, macOS and Linux — including for profiles your app created, because none of those platforms record which app wrote an entry.

Operation Android iOS / Catalyst macOS Windows Linux
List ⚠️ own app only ⚠️ own app only
Forget ⚠️ own app only ⚠️ own app only ⚠️ needs admin auth ✅ (polkit)
Connect by id ⚠️ API ≤ 28
if (wifi.Capabilities.HasFlag(WifiCapabilities.KnownNetworks))
ShowSavedNetworksList();
if (wifi.Capabilities.HasFlag(WifiCapabilities.ForgetNetwork))
ShowForgetButton();
if (wifi.Capabilities.HasFlag(WifiCapabilities.ConnectKnownNetwork))
ShowRejoinButton();

Joining with Remember = true — the default — is what saves it:

await wifi.Connect(
new WifiConnectionRequest("Kitchen")
{
Passphrase = "hunter2hunter2",
Remember = true
},
ct
);

What that writes differs by platform. Windows, macOS and Linux save an ordinary profile. iOS keeps the hotspot configuration until the app is deleted or Forget removes it. Android 11+ registers a WifiNetworkSuggestion alongside the join — the join itself is still a WifiNetworkSpecifier and is never persisted, so the suggestion exists purely to let the OS come back to the network later, and it only takes effect once the user approves the notification Android raises.

Setting Remember = false leaves nothing behind anywhere.

var home = (await wifi.GetKnownNetworks(ct))
.FirstOrDefault(x => x.Ssid == "Kitchen");
if (home != null && wifi.Capabilities.HasFlag(WifiCapabilities.ConnectKnownNetwork))
{
var joined = await wifi.Connect(home.Id, ct);
Console.WriteLine($"Back on {joined.Ssid} at {joined.IPv4Address}");
}

Like the passphrase-based overload, this returns only once an address has been assigned.

Connect(id) is a desktop feature. On iOS and Android 10+ a saved network is a standing hint the OS acts on when the network is in range and it feels like it — there is no call to force the join, so the capability flag is absent and the call throws WifiNotSupportedException. Use Connect(WifiConnectionRequest) with the passphrase there instead.

The network still has to be in range. macOS in particular associates to a scanned access point rather than to a name, so it scans for the SSID first; the passphrase comes out of the login keychain and your app never sees it.

await wifi.Forget(known.Id, ct);

Forgetting the network you are currently on drops you off it. An id that is already gone is not an error — the call is safe to make speculatively.

On Linux, deleting goes through polkit — interactive on a desktop, and in a headless session needing a rule for org.freedesktop.NetworkManager.settings.modify.system.

GetKnownNetworks() is cheap on mobile and not free on desktop: Windows reads one profile’s XML per entry through wlanapi.dll, and Linux makes one D-Bus round trip per profile because NetworkManager has no bulk read. Cache the result and refresh it on demand rather than polling it.

Platform API
iOS / Mac Catalyst NEHotspotConfigurationManager.getConfiguredSSIDs / removeConfiguration(forSSID:)
Android 11+ WifiManager.getNetworkSuggestions / removeNetworkSuggestions
Android ≤ 9 WifiManager.getConfiguredNetworks / removeNetwork / enableNetwork
macOS CWConfiguration.networkProfiles, committed back through CWInterface.commitConfiguration
Windows wlanapi.dllWlanGetProfileList, WlanGetProfile, WlanDeleteProfile, WlanConnect. WinRT’s WiFiAdapter has no concept of a saved profile
Linux NetworkManager Settings.ListConnections, Connection.GetSettings / Delete, ActivateConnection

Read on: Networks · Hotspot · Platform Setup