SkillAgentSearch skills...

CameraScanner.Maui

Camera preview and barcode scanner for .NET MAUI apps

Install / Use

/learn @thomasgalliker/CameraScanner.Maui

README

CameraScanner.Maui

Version Downloads Buy Me a Coffee

This library offers camera preview and barcode scanning functionality for .NET MAUI apps using native platform APIs with Google ML Kit and Apple VisionKit.

Download and Install CameraScanner.Maui

This library is available on NuGet: https://www.nuget.org/packages/CameraScanner.Maui Use the following command to install CameraScanner.Maui using NuGet package manager console:

PM> Install-Package CameraScanner.Maui

You can use this library in any .NET MAUI project compatible to .NET 8 and higher.

App Setup

  1. This plugin provides an extension method for MauiAppBuilder UseCameraScanner which ensure proper startup and initialization. Call this method within your MauiProgram just as demonstrated in the CameraDemoApp:
    var builder = MauiApp.CreateBuilder()
        .UseMauiApp<App>()
        .UseCameraScanner();
    
  2. Add camera permission for Android in your AndroidManifest.xml file. Add the following uses-permission entry inside of the manifest node:
    <uses-permission android:name="android.permission.CAMERA" />
    
  3. Add camera permission for iOS in your Info.plist file. Add the following permission inside of the dict node:
    <key>NSCameraUsageDescription</key>
    <string>Required to display camera preview and scan barcodes.</string>
    
    Permission strings can also be localized on iOS using lproj-folders and InfoPlist.strings files. Read this if you're interested in this topic.

Sample App

In the Samples folder of this repository, you will find the CameraDemoApp, which demonstrates the features of CameraScanner.Maui. To debug, clone the repository and run the sample app directly in your development environment.

You can also download the sample app from the Google Play Store and the App Store using the links below:

<a href="https://play.google.com/store/apps/details?id=ch.superdev.camerascanner"> <img src="https://raw.githubusercontent.com/thomasgalliker/CameraScanner.Maui/refs/heads/develop/Images/GooglePlay/en_badge_web_generic.png" height="44px" alt="Get it on Google Play" /> </a> <a href="https://apps.apple.com/ch/app/camera-scanner-sdk/id6752654209"> <img src="https://raw.githubusercontent.com/thomasgalliker/CameraScanner.Maui/refs/heads/develop/Images/AppStore/download-on-the-app-store.svg" height="44px" alt="Download on the App Store"> </a>

API Usage

The following documentation guides you trough the most important use cases of this library. Not all aspects are covered. If you think there is something important missing here, feel free to open a new issue.

This documentation only demonstrates the use of CameraScanner.Maui within a XAML and MVVM based app. Of course, the code also runs in C# and code-behind UIs.

Use CameraView in XAML

In order to add the camera preview control CameraView to your xaml page, you need to add the xml namespace in the root of your xaml file:

xmlns:c="http://camerascanner.maui"

Then, you can add CameraView to your xaml UI. Set CameraEnabled="True" in order to start the camera preview.

<c:CameraView CameraEnabled="True" />

There are several bindable properties in CameraView in order to configure and control the camera preview.

Configure CameraView

| Property | Description | |-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | AutoDisconnectHandler | Defines if the platform handler is automatically disconnected or if Handler.DisconnectHandler(); is called manually. Default: true for (automatically disconnected). This property only exists for apps with TFM net8.0. | | VibrationOnDetected | Enables or disables vibration on successful barcode detection. Default: false | | SoundOnDetected | Enables or disables sound on successful barcode detection. Default: false | | SoundSource | The stream of the sound used to indicate a successful barcode detection. | | SoundVolume | The volume of the sound played when acoustic barcode detection is enabled. | | CameraEnabled | Enables or disables the camera preview. Default: false | | PauseScanning | Pauses barcode scanning. | | ForceInverted | Forces scanning of inverted barcodes. Reduces performance significantly. Android only. | | PoolingInterval | Enables pooling of detections for better detection of multiple barcodes at once. Value in milliseconds. Default: 0 (disabled). | | TorchOn | Enables or disables the torch. | | TapToFocusEnabled | Disables or enables tap-to-focus. | | CameraFacing | Select front or back facing camera. Default:

View on GitHub
GitHub Stars115
CategoryDevelopment
Updated10d ago
Forks11

Languages

C#

Security Score

100/100

Audited on Mar 17, 2026

No findings