Skip to main content

.NET MAUI Barcode Scanner SDK - Getting Started

Download & Installation

The Scanbot Barcode Scanner SDK for MAUI is available in two NuGet packages:

  • ScanbotBarcodeSDK.NET - contains the Scanbot Barcode Scanner SDK .NET bindings and wrappers for Android and iOS platforms.
  • ScanbotBarcodeSDK.MAUI - designed for compatibility with MAUI and provides portable wrappers for the Scanbot Barcode Scanner SDK.

Install ScanbotBarcodeSDK.MAUI if your project is based on MAUI, otherwise install ScanbotBarcodeSDK.NET.

You can install them directly via Visual Studio IDE: Open your App-Solution in Visual Studio, select your iOS or Android project and click on the menu item Project -> Add NuGet Packages. Make sure nuget.org is selected as the source and search for the package.

By clicking on Add Package the Scanbot Barcode Scanner SDK will be downloaded and installed into your project. Do that for both your iOS and Android projects.

Permissions

Required permissions for Android

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" />

Project Settings

Required: TargetFrameworks

In a newly created MAUI project, the default configuration includes targeting multiple platforms such as Android, iOS, and macOS Catalyst.

Adjust the TargetFrameworks setting to only include net8.0-android and net8.0-ios, removing unnecessary targets like net8.0-maccatalyst and the conditional Windows target. This ensures that the project focuses only on the supported platforms.

alt

Required: Optimizing Platform Compatibility

In the default configuration of a newly created MAUI project, the <SupportedOSPlatformVersion> settings are initially configured to cater to various platforms including iOS, macOS Catalyst, Android, Windows, and Tizen.

However, since our NuGet only supports Android and iOS, it's necessary to refine these settings accordingly. Specifically, we should remove the conditions for macOS Catalyst, Windows, and Tizen, while updating the iOS version to 13.0. This adjustment ensures that the project's configuration is tailored precisely to the supported platforms, enhancing compatibility and focus.

alt

Optional: ABI Settings

The Scanbot Barcode Scanner SDK uses native libraries under the hood and supports the following ABIs: armeabi-v7a, arm64-v8a, x86 and x86_64.

Please adjust the Supported ABIs configuration in your Android project settings accordingly:

Android Project => Options => Android Build => Advanced => Supported ABIs ...

alt

Please note: In most cases the architectures x86 and x86_64 can be removed for the release (production) build, since they are only used on emulators and on some rare devices with the Intel Atom architecture.

Furthermore, please increase the Java Heap Size value to 4G. This is required for the build process.

Optional: ProGuard

If you need to enable ProGuard for your Android release build, please check this full list of the ProGuard rules for the Scanbot SDK.

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?