Quick start for the .NET MAUI Barcode Scanner SDK


In this section, you'll learn how to set up the Scanbot Barcode Scanner SDK for .NET MAUI in your app, with Barcode Scanning enabled, all within 10 minutes — thanks to our Ready-to-Use UI!
Install the Barcode Scanner SDK
The Scanbot Barcode Scanner SDK for MAUI is available as the NuGet package ScanbotBarcodeSDK.MAUI.
Add the NuGet package to your *.csproj file in your project folder:
<ItemGroup>
<PackageReference Include="ScanbotBarcodeSDK.MAUI" Version="8.0.0" />
</ItemGroup>
To get the latest version of the Scanbot SDK, refer to the changelogs for MAUI and .NET.
Now, in your project folder, execute the dotnet restore command from the terminal to install the newly added NuGet package in your project.
Define the camera permissions
The Scanbot Barcode Scanner SDK needs access to the device camera so it can scan from a live camera stream. Therefore, the camera permission must be defined.
- Android
- iOS
Make sure to add the Camera permission in your AndroidManifest.xml file:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
The uses-feature tag also improves recognition of your app on the Google Play Store (see more).
Add the following properties to your Info.plist file:
<key>NSCameraUsageDescription</key>
<string>Please provide camera access to Scanbot SDK.</string>
Initialize the SDK
Before using any feature of the .NET MAUI Barcode Scanner SDK, you need to initialize it.
using Microsoft.Extensions.Logging;
using ScanbotSDK.MAUI;
// Replace test_maui with the namespace of your app.
namespace test_maui;
public static class MauiProgram
{
// Without a license key, the Scanbot Barcode SDK will work for 1 minute.
// To scan longer, register for a trial license key here: https://docs.scanbot.io/trial/
public const string LicenseKey = "";
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
ScanbotSDKMain.Initialize(new SdkConfiguration
{
LoggingEnabled = true,
LicenseKey = LicenseKey
}, builder);
return builder.Build();
}
}
You can use the Scanbot .NET MAUI Barcode Scanner SDK for quick testing or evaluation purposes even without a license key. However, the SDK will only work for 60 seconds per app session and may not be used for production purposes.
Want to scan longer than 60 seconds? Get your free trial license key here.
Implement the scanning modes
The SDK's RTU UI Components make it easy to deploy the different barcode scanning modes in your app.
To start the single-scanning mode, add the following code to your project folder's Page(xaml.cs) file:
using ScanbotSDK.MAUI;
using ScanbotSDK.MAUI.Barcode;
// Replace test_maui with the namespace of your app.
namespace test_maui;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void StartSingleScanning(object sender, EventArgs e)
{
// Create the default configuration object.
var configuration = new BarcodeScannerScreenConfiguration();
// Initialize the single-scan use case.
var singleUsecase = new SingleScanningMode();
// Enable and configure the confirmation sheet.
singleUsecase.ConfirmationSheetEnabled = true;
// Set the configured use case.
configuration.UseCase = singleUsecase;
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
if (result.IsSuccess)
{
var firstItem = result.Value.Items.FirstOrDefault();
var barcodeAsText = firstItem != null ? $"{firstItem.Barcode.Format}: {firstItem.Barcode.Text}" : string.Empty;
await DisplayAlert("Found barcode", barcodeAsText, "Finish");
}
}
}
Now go to the xaml file of your Page and edit the button on the start screen so it calls the StartSingleScanning method when clicked:
<Button
x:Name="SingleScanningBtn"
Text="Start single-barcode scanning"
SemanticProperties.Hint="Starts the process to scan a single barcode"
Clicked="StartSingleScanning"
HorizontalOptions="Fill" />
Now you can build and run the app to see if everything is working correctly so far:
iOS
dotnet build <ProjectName.csproj> -t:Run -f:net10.0-ios -r:ios-arm64 -p:_DeviceName=:<Your-Device-UDID>
To get all the iOS simulators' and devices' UDIDs, you can run:
xcrun xctrace list devices
Android
dotnet build <ProjectName.csproj> -f:net10.0-android -t:Run -p:AndroidDeviceId=<Your-Device-Id>
To get all the Android emulators' and devices' IDs, you can run:
adb devices
🚀 That's it! 🚀 You have successfully integrated a full-featured barcode scanner as an RTU UI Component into your app.
💡 Customization: In this Quick Start guide, we use the default configuration for the scanner UI.
Feel free to explore the configs and customize the UI and behavior according to your needs via
the BarcodeScannerScreenConfiguration class.
For more details, please refer to the Ready-to-Use UI section.
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial licenseScanbot SDK is part of the Apryse SDK product family
A mobile scan is just the start. With Apryse SDKs, you can expand mobile workflows into full cross‑platform document processing. Whether you need to edit PDFs, add secure digital signatures, or use a fast, customizable document viewer and editor, Apryse gives you the tools to build powerful features quickly.
Learn more
