Networking.Maui.Android 1.0.1

dotnet add package Networking.Maui.Android --version 1.0.1
                    
NuGet\Install-Package Networking.Maui.Android -Version 1.0.1
                    
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="Networking.Maui.Android" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Networking.Maui.Android" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Networking.Maui.Android" />
                    
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 Networking.Maui.Android --version 1.0.1
                    
#r "nuget: Networking.Maui.Android, 1.0.1"
                    
#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 Networking.Maui.Android@1.0.1
                    
#: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=Networking.Maui.Android&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Networking.Maui.Android&version=1.0.1
                    
Install as a Cake Tool

Networking.Maui.Android

NuGet Badge License

Networking.Maui.Android is a .NET MAUI library that provides useful Netwokring tools to use for Android in your application. This library is build in base of another Java library (AndroidNetworkTools link to repo) in order to simplify Networking in .NET MAUI. feel free to fork and add your features to the project by creating pull request on it.

Table of Contents

Features

  • Easy access to Networking of Andoird
  • Simple API for fast usage.
  • Java native code behind
  • Port Scanning
  • Subnet Device Finder (discovers devices on local network)
  • Ping
  • Wake-On-Lan

Getting Started

  • Install Nuget package NuGet Badge OR
  • You can install the library via NuGet:

.NET CLI

dotnet add package Maui.Networking.Android

Package Manager Console

NuGet\Install-Package Maui.Networking.Android

Prerequisites

  • .NET SDK (version 8.0.0 or later)
  • .NET MAUI
  • Permission in MAUI app manifest xml file
 <uses-permission android:name="android.permission.INTERNET" />

Usage and examples

  • Device Search
var foundDevices = await SubnetScanner.Instance.FindDevicesAsync();
var foundDevices = await SubnetScanner.Instance.FindDeviceByIpAsync(ip);
  • Ping
//sync
var result = await Pinger.Instance.Ping(ipText.Text, pingCount: 2);
//async
var result = await Pinger.Instance.PingAsync(ipText.Text, pingCount: 2);
  • Port Scan
//sync
 var foundPorts = await PortScanner.Instance.Scan(ip, [10, 20, 80, 90], 1000, Enums.TransportType.Tcp);
//async
 var foundPorts = await PortScanner.Instance.ScanAsync(ip, [10, 20, 80, 90], 1000, Enums.TransportType.Tcp);
  • Utility methods
//methods inside NetworkUtils class
NetworkUtils.GetMacAddressFromIp(ip);
NetworkUtils.GetIpAddressFromMac(mac);
NetworkUtils.GetMacAddressBytes(mac);
NetworkUtils.IsValidMacAddress(mac);
NetworkUtils.IsIPv6Address(ip);
NetworkUtils.IsIPv4Address(ip)
NetworkUtils.IsIPv6HexCompressedAddress(ip);
NetworkUtils.IsIpAddressLocalNetwork(ip);
NetworkUtils.IsIPv6StdAddress(ip);
NetworkUtils.GetLocalIpv4Address();
NetworkUtils.IsIpAddressLocalhost(ip);

For more additional examples and info you can install Demo Application in repository of project.

Contribution

  1. Fork it
  2. Create your feature branch
git checkout -b new-feature
  1. Commit your changes
git commit -am 'feature to approve'
  1. Push to the branch
git push origin my-new-feature
  1. Create new Pull Request
Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net9.0-android was computed.  net10.0-android 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.1 178 10/3/2024