Plugin.Maui.NetworkMonitor
1.0.1
See the version list below for details.
dotnet add package Plugin.Maui.NetworkMonitor --version 1.0.1
NuGet\Install-Package Plugin.Maui.NetworkMonitor -Version 1.0.1
<PackageReference Include="Plugin.Maui.NetworkMonitor" Version="1.0.1" />
<PackageVersion Include="Plugin.Maui.NetworkMonitor" Version="1.0.1" />
<PackageReference Include="Plugin.Maui.NetworkMonitor" />
paket add Plugin.Maui.NetworkMonitor --version 1.0.1
#r "nuget: Plugin.Maui.NetworkMonitor, 1.0.1"
#:package Plugin.Maui.NetworkMonitor@1.0.1
#addin nuget:?package=Plugin.Maui.NetworkMonitor&version=1.0.1
#tool nuget:?package=Plugin.Maui.NetworkMonitor&version=1.0.1
Maui.NetworkMonitor
MAUI library for Android and iOS that reports real internet availability, not just “connected to a network”.
It watches native path changes, classifies Wi-Fi vs cellular, and uses HTTP probes (plus Android captive-portal capabilities) to detect:
- Validated public internet
- Captive portals (hotel / airport / guest Wi-Fi sign-in)
- Offline and local-network-only states
- Wi-Fi ↔ mobile transitions
Install
dotnet add package Plugin.Maui.NetworkMonitor
Target frameworks shipped: net8.0, net9.0, and net10.0, with net9.0/net10.0 Android and iOS packs.
Usage
using Maui.NetworkMonitor;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>();
builder.Services.AddNetworkMonitor(options =>
{
options.EnableHttpProbe = true;
options.EnableCaptivePortalDetection = true;
options.ReprobeInterval = TimeSpan.FromSeconds(30);
});
return builder.Build();
}
}
public sealed class ConnectivityViewModel
{
public ConnectivityViewModel(INetworkMonitor monitor)
{
monitor.StatusChanged += (_, e) =>
{
if (e.Current.IsCaptivePortal)
{
// Prompt the user to sign in.
}
if (e.IsTransportTransition)
{
// e.g. Wi-Fi → Cellular
}
};
}
}
Manual use without DI:
using var monitor = NetworkMonitor.Create();
monitor.Start();
var status = await monitor.RefreshAsync();
What NetworkStatus tells you
| Property | Meaning |
|---|---|
HasInternet |
Public internet was validated |
IsCaptivePortal |
Sign-in page is intercepting traffic |
Reachability |
Offline, LocalNetworkOnly, CaptivePortal, Internet |
PrimaryTransport |
WiFi, Cellular, Ethernet, … |
IsExpensive / IsConstrained |
Metered / Low Data Mode |
ActiveTransports |
All transports on the current path |
NetworkChangeKind.TransportChanged is raised for Wi-Fi ↔ cellular handoffs.
How detection works
- Android —
ConnectivityManager.NetworkCallbackplusNET_CAPABILITY_VALIDATEDandNET_CAPABILITY_CAPTIVE_PORTAL. - iOS —
NWPathMonitorfor path status, Wi-Fi/cellular, expensive, and constrained flags. - HTTP probes — known generate_204 / hotspot-detect endpoints. A 204 or expected success body is internet; a redirect, unexpected HTML, or TLS interception on a connected path is treated as a captive portal.
Probes use SocketsHttpHandler with redirects disabled so portal login pages are visible.
Permissions
The Android package declares:
INTERNETACCESS_NETWORK_STATEACCESS_WIFI_STATE
No extra iOS entitlements are required. Optional ATS exceptions for the HTTP probe hosts improve captive-portal accuracy if the OS blocks cleartext:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>captive.apple.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>connectivitycheck.gstatic.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>www.msftconnecttest.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Pack
dotnet pack src/Maui.NetworkMonitor/Maui.NetworkMonitor.csproj -c Release -o artifacts
Sample
samples/Maui.NetworkMonitor.Sample is a MAUI Android/iOS app that shows live reachability, transport, and a change log.
Support
If this plugin saved you a weekend of native plumbing, consider buying me a coffee. Your support keeps it maintained, documented, and free.
This library stays open source. A coffee helps cover time for bug fixes, new features, and docs.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-ios18.0 is compatible. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
-
net10.0-android36.0
-
net10.0-ios26.0
-
net8.0
-
net9.0
-
net9.0-android35.0
-
net9.0-ios18.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Plugin.Maui.NetworkMonitor:
| Package | Downloads |
|---|---|
|
Plugin.Maui.Observability
Umbrella telemetry pipeline for .NET MAUI on iOS and Android. Unifies AppHealth, NetworkMonitor, ApiResilience, BackgroundTasks, OfflineSync, SmartUpload, and DeviceSession into one signal stream, and exports to OpenTelemetry, Application Insights, Sentry, Datadog, Console, or a custom HTTP endpoint. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Include the Buy Me a Coffee support section in the package README.