Plugin.Scanner.Core
0.0.1-alpha
dotnet add package Plugin.Scanner.Core --version 0.0.1-alpha
NuGet\Install-Package Plugin.Scanner.Core -Version 0.0.1-alpha
<PackageReference Include="Plugin.Scanner.Core" Version="0.0.1-alpha" />
<PackageVersion Include="Plugin.Scanner.Core" Version="0.0.1-alpha" />
<PackageReference Include="Plugin.Scanner.Core" />
paket add Plugin.Scanner.Core --version 0.0.1-alpha
#r "nuget: Plugin.Scanner.Core, 0.0.1-alpha"
#:package Plugin.Scanner.Core@0.0.1-alpha
#addin nuget:?package=Plugin.Scanner.Core&version=0.0.1-alpha&prerelease
#tool nuget:?package=Plugin.Scanner.Core&version=0.0.1-alpha&prerelease
📱 Plugin.Scanner
EARLY ALPHA
- Planned
- More options for IBarcodeScanner(Zoom, multiple recognition, enable/disable highlighting, recognition area)
- Custom data scanner view with overlay etc.
- Custom overlay for IBarcodeScanner
- Custom behavior for IBarcodeScanner
- TextScanner and DocumentScanner
🚀 Mobile cross platform data scanner
This plugin aims to enalbe simple, fast and customizable data scanning(barcodes, text, documents...) using native Android and iOS APIs ML Kit and Vision Kit.
- Platform support iOS 16+ and Android 23+
- Native AI supported detection
- One Shared API cross platforms and frameworks
- Scan barcodes with only 2 lines of code
🚀 Get started
🔧 Platform specific setup
To access the scanner functionality, the following platform-specific setup is required. The application will crash without this setup.
<details> <summary><b>iOS</b></summary>
In the Info.plist file, add the following keys and values:
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to scan data.</string>
</details>
<details> <summary><b>Android</b></summary>
The CAMERA permission is required and must be configured in the Android project. In addition:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
</details>
⬇️ Installation
Install the NuGet package:
<details> <summary><b>MAUI</b></summary>
dotnet add package Plugin.Scanner.Maui
</details>
<details> <summary><b>Uno</b></summary>
dotnet add package Plugin.Scanner.Uno
</details>
<details> <summary><b>Avalonia</b></summary>
dotnet add package Plugin.Scanner.Avalonia
</details>
Please note: If you encounter this issue, you will need to enable long path support as described here.
⚙️ Setup
<details> <summary><b>MAUI</b></summary>
Enable the plugin in your MauiProgram.cs:
namespace Plugin.Scanner.Maui.Hosting;
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseScanner();
return builder.Build();
}
</details>
<details> <summary><b>Uno</b></summary>
Enable the plugin in your App.xaml.cs:
using Plugin.Scanner.Uno.Hosting;
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
IApplicationBuilder builder = this.CreateBuilder(args)
.UseScanner();
MainWindow = builder.Window;
Host = await builder.NavigateAsync<Shell>();
}
</details>
<details> <summary><b>Avalonia</b></summary>
Initialize the plugin in your android MainActivity.cs:
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
Hosting.Scanner.Init(this);
}
</details>
🔳 Barcode scanning
<details> <summary><b>Implementation details</b></summary>
- On iOS the scanner uses VisionKits DataScannerViewController
- On Android the scanner uses Googles BarcodeScanner
</details>
<details> <summary><b>MAUI & Uno</b></summary>
Resolve the registered IBarcodeScanner service and scan a single barcode in all supported formats
using Plugin.Scanner.Core.Barcode;
using Plugin.Scanner.Core.Exceptions;
public class MainViewModel
{
private readonly IBarcodeScanner _barcodeScanner;
public MainViewModel(IBarcodeScanner barcodeScanner)
{
_barcodeScanner = barcodeScanner;
}
public async Task ScanBarcode()
{
try
{
IBarcode barcode = (await _barcodeScanner.ScanAsync(new BarcodeScanOptions() { Formats = BarcodeFormat.All }).ConfigureAwait(false)).RawValue;
}
catch(BarcodeScanException exception)
{
Debug.WriteLine(exception);
}
}
}
</details>
<details> <summary><b>Avalonia</b></summary>
Since dependency injection is not available out of the box a static implementation of the scanner must be used.
If you use dependency injection register the IBarcodeScanner serivce with the IServiceCollection.AddBarcodeScanner() extension method. See Maui and Uno examples.
using Plugin.Scanner.Core.Barcode;
using Plugin.Scanner.Core.Exceptions;
public partial class MainViewModel
{
public async Task ScanBarcode()
{
try
{
IBarcode barcode = (await BarcodeScanner.Default.ScanAsync(new BarcodeScanOptions() { Formats = BarcodeFormat.All }).ConfigureAwait(false)).RawValue;
}
catch (BarcodeScanException exception)
{
Debug.WriteLine(exception);
}
}
}
</details>
You want to detect only specific format(s)? Create options and set the target formats(s)
var options = new BarcodeScanOptions
{
Formats = BarcodeFormat.QR | BarcodeFormat.Ean13
};
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
var barcode = await scanner.ScanAsync(options, cts.Token);
Console.WriteLine($"Scanned: {barcode.RawValue}");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Plugin.Scanner.Core:
| Package | Downloads |
|---|---|
|
Plugin.Scanner
Package Description |
|
|
Plugin.Scanner.iOS
Package Description |
|
|
Plugin.Scanner.Android
Package Description |
|
|
Plugin.Scanner.Avalonia
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-alpha | 57 | 2/13/2026 |