Aquila.Network 1.0.0

dotnet add package Aquila.Network --version 1.0.0
                    
NuGet\Install-Package Aquila.Network -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aquila.Network" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aquila.Network" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Aquila.Network" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aquila.Network --version 1.0.0
                    
#r "nuget: Aquila.Network, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aquila.Network@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aquila.Network&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Aquila.Network&version=1.0.0
                    
Install as a Cake Tool

Aquila.Network

Cross-platform network utilities for .NET MAUI applications.

Author: Aswin Sadhasivam Company: Aquila Innovations Website: https://aquilainnovations.in License: MIT License


1. Overview

Aquila.Network is a lightweight library designed to simplify network-related operations in .NET MAUI applications.

It provides:

  • Network availability checking (online/offline)
  • Network change event notifications
  • Ping / API endpoint testing
  • Cross-platform support for Android and Windows
  • Static API for easy usage without DependencyService

This library is ideal for apps that need to react to connectivity changes or ensure that network operations only occur when the device is online.


2. Benefits

  • Easy to Use: Call NetworkManager methods directly from shared MAUI code.
  • Cross-Platform: Supports Android and Windows with platform-specific implementations.
  • Lightweight: No external dependencies or complex setup.
  • Reusable: Can be distributed as a NuGet package for multiple projects.
  • Event-driven: Subscribe to connectivity changes using a simple event.
  • Extensible: Ready for future support on iOS, MacCatalyst, and other platforms.

3. Installation

NuGet

dotnet add package Aquila.Network

Or via Visual Studio:

  1. Right-click your project → Manage NuGet Packages
  2. Search for Aquila.Network
  3. Install the latest version

4. Usage

4.1 Check Online Status

using Aquila.Network;

if (NetworkManager.IsOnline())
{
    Console.WriteLine("Device is online");
}
else
{
    Console.WriteLine("Device is offline");
}

4.2 Subscribe to Network Changes

NetworkManager.NetworkStatusChanged += (sender, e) =>
{
    if (e.IsOnline)
        MsgBits.Show("You are back online!");
    else
        MsgBits.Show("You are offline!");
};

// Start monitoring (optional for Windows, automatic on Android)
#if ANDROID
Aquila.Network.Platforms.Android.NetworkService.StartMonitoring();
#elif WINDOWS
Aquila.Network.Platforms.Windows.NetworkService.StartMonitoring();
#endif

4.3 Ping a Server or API Endpoint

bool serverAlive = await NetworkManager.PingAsync("https://aquilainnovations.in");
MsgBits.Show(serverAlive ? "Server reachable" : "Server unreachable");

5. Architecture

  • NetworkManager.cs → Shared static API for all MAUI projects
  • Platforms/Android/NetworkService.cs → Android implementation using ConnectivityManager
  • Platforms/Windows/NetworkService.cs → Windows implementation using NetworkInformation
  • Events: NetworkStatusChanged allows apps to react to connectivity changes

Platform-specific code is completely isolated. The shared API never references platform-specific classes directly.


6. Best Practices

  • Use NetworkManager in shared code to keep your app platform-agnostic.
  • Subscribe to NetworkStatusChanged events to handle offline/online scenarios dynamically.
  • Avoid direct references to platform APIs in your app code.
  • Use PingAsync to check server availability before executing network requests.
  • For long-running network checks, run PingAsync inside a Task.Run or Dispatcher to avoid UI blocking.

7. FAQ

Q: Does this work on iOS or MacCatalyst? A: Currently, the library supports Android and Windows. iOS/MacCatalyst support can be added later.

Q: Do I need to register anything in MauiProgram.cs? A: No, NetworkManager is static; no DependencyService registration is required.

Q: Can I customize how often network changes are checked? A: On Android, the library uses ConnectivityManager callbacks for real-time detection. On Windows, the library uses NetworkInformation.NetworkStatusChanged events.

Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net8.0-windows10.0.19041 is compatible.  net9.0-android was computed.  net9.0-windows was computed.  net10.0-android was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 182 2/2/2026