AMLBarcodeScannerLib 1.8.0

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

AML Barcode Scanner Library NuGet

Overview

AML Barcode Scanner Library provides an easy way to interface with an AML device's barcode scanner. The library allows you to create an instance of AMLBarcodeScanner. You can listen for incoming barcode scan data and configure scanner settings. This library works for Android.Xamarin, Xamarin Forms, and Maui.

Usage

The library contains a class called AMLBarcodeScanner that is used to interface with the scanner:

var scanner = new AMLBarcodeScanner(this);

The parameter for the constructor is the Context of the Android application.

Example

Opening the scanner and registering for scan data.

var scanner;

public void initScanner()
{
    scanner = new AMLBarcodeScanner(this);

    //Open the scanner connection
    scanner.Open();
    scanner.Scanned += ReceiveScan;   
}

public void ReceiveScan(string barcode, string rawBarcode)
{
    //Process barcode data
}

Querying and updating scanner settings.

public void QueryScannerSettings()
{
    scanner.GetScannerSettings(ScannerSettingsReceived);
}

public void ScannerSettingsReceived(ScannerSettings settings)
{
    var currentSuffix = settings.GetSuffix();
    if (currentSuffix == null || currentSuffix != "!")
    {
        settings.SetSuffix("!");
        scanner.ChangeSettings(settings);
    }
}

Registering for trigger events.

public void RegisterTriggerEvents()
{
    scanner.TriggerPulled += TriggerWasPulled;   
    scanner.TriggerReleased += TriggerWasReleased; 
}

public void TriggerWasPulled()
{
    //Handle trigger pull
}

public void TriggerWasReleased()
{
    //Handle trigger release
}

Querying BT Scanner and registering for events.

BTDeviceInfo storedBTScanner;

public void GetCurrentBTDevice()
{
    if (AMLDevice.IsBTScannerSupported())
        scanner.GetBTScannerInfo(ReceivedBTScannerInfo);
}

public void ReceivedBTScannerInfo(BTDeviceInfo btDevice)
{
    var name = btDevice.GetBTName();
    if (!String.IsNullOrEmpty(name))
    {
        storedBTScanner = btDevice;
        RegisterBTScannerEvents();
    }
}

public void RegisterBTScannerEvents()
{
    scanner.BTScannerConnected += BTScannerConnect;   
    scanner.BTScannerDisconnected += BTScannerDisconnect; 
    scanner.BTScannerLowBattery += BTLowBattery;
}

public void BTScannerConnect(BTScanDevice btDevice)
{
    //Add functionality
}

public void BTScannerDisconnect(BTScanDevice btDevice)
{
    //Add functionality
}

public void BTLowBattery(int batteryLevel)
{
    //Add functionality
}

Configuring scan intents. On each scan, the scanner service sends every configured scan intent with the barcode data (this is the same as the Scan Intents screen in the AML Barcode Scanner app settings).

public void ConfigureScanIntents()
{
    var intent = new ScanIntent("com.example.myapp.SCAN", ScanIntentSendType.SENDBROADCAST);
    intent.SetExtraName("barcode");             //Extra that holds the barcode data. Empty uses "d".
    intent.SetCategory("");                     //Optional
    intent.AddPackage("com.example.myapp");     //Optional, target specific package(s)
    intent.AddExtra("source", "aml");           //Optional, additional string extras

    //Replaces the full list of scan intents. Pass an empty list to remove all.
    scanner.SetScanIntents(new List<ScanIntent> { intent });
    scanner.EnableScanIntents();
}

Scan intents are also available on ScannerSettings via GetScanIntents() / SetScanIntents() and IsScanIntentsEnabled() / SetScanIntentsEnabled(), so you can read the current list, modify it, and send it back with ChangeSettings().

Product Compatible and additional computed target framework versions.
MonoAndroid monoandroid10 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.8.0 111 10/30/2026
1.7.0 182 5/22/2026
1.6.0 1,514 4/2/2024
1.5.0 241 4/2/2024
1.4.0 241 4/2/2024
1.3.0 1,904 3/6/2024
1.2.0 344 2/22/2024
1.1.0 359 2/20/2024
1.0.0 346 2/20/2024

Added Scan Intents configuration (EnableScanIntents, DisableScanIntents, SetScanIntents, and ScannerSettings scan intent support).