Getting started with the .NET MAUI Barcode Scanner SDK's Custom UI
Permission validation
Custom UI Components do not automatically validate camera access permissions. It's up to developers to request and secure these permissions within their applications.
Before integrating camera functionalities, ensure that your app has obtained the necessary permissions to provide users with a seamless experience.
- MAUI
- .NET Android
- .NET iOS
For MAUI applications, see our example on how to request camera permissions to ensure smooth operation:
loading...
Since Android 6.0 (API level 23) you also have to implement a suitable permission requesting and handling at runtime. For more details, see the Android docs "Request App Permissions"
private string[] permissions = new string[] { Manifest.Permission.Camera };
loading...
For .NET iOS applications, see our example on how to request camera permissions to ensure smooth operation:
loading...
For a fully functional example, see our example app scanbot-barcode-sdk-maui-example on GitHub.
BarcodeScannerView
BarcodeScannerView extends BaseBarcodeScannerView with additional functionality specific to barcode scanning scenarios.
Properties and Event Handlers
-
Properties
- BackgroundColor: Determines the background color of the scanner view. Defaults to
Colors.Transparent. - OverlayTextEnabled: A boolean that indicates whether the text overlay is enabled on the scanner. Defaults to
true. - OverlayConfiguration: Configures the overlay for the barcode scanner view.
- IsFlashEnabled: Controls the camera flash state.
- FinderConfiguration: Customizes the finder's appearance and behavior.
- CameraZoomRange: Sets the valid camera zoom factors.
- CameraZoomLevel: Adjusts the camera's zoom level.
- BarcodeFormatConfigurations: Defines the barcode formats that the scanner will recognize.
- MinFocusDistanceLock: Locks the camera's minimum focus distance.
- CameraModule: Chooses the camera module (e.g.
Front,Back, orBackWidest). Note: TheBackWidesttype is iOS only.
- BackgroundColor: Determines the background color of the scanner view. Defaults to
-
Functions
- Resume: Resumes the camera session.
- Pause: Pauses the camera session.
- StartDetection: Starts the detection of barcodes, while the camera is still on.
- StopDetection: Stops the detection of barcodes, while the camera is still on.
-
Event Handlers
- OnBarcodeScanResult: Subscribe to this event to receive the Barcodes scan result.
- OnSelectBarcodeResult: Subscribe to this event to receive the barcodes result by user interaction.
- OnBarcodeScanningError: Subscribe to this event to receive failures occurred while barcode scanning.
BarcodeScanAndCountView
BarcodeScanAndCountView extends the BaseBarcodeScannerView to facilitate scenarios requiring both barcode scanning and counting.
Properties and Event Handlers
-
Properties
- BackgroundColor: Sets the background color of the view. Default is
Colors.Transparent. - CheckMarkImageByteArray: A byte array for the custom check mark image to be displayed after a successful scan.
- OverlayConfiguration: Configures the overlay for the barcode scanner view.
- IsFlashEnabled: Controls the camera flash state.
- FinderConfiguration: Customizes the finder's appearance and behavior.
- CameraZoomRange: Sets the valid camera zoom factors.
- CameraZoomLevel: Adjusts the camera's zoom level.
- BarcodeFormatConfigurations: Defines the barcode formats that the scanner will recognize.
- MinFocusDistanceLock: Locks the camera's minimum focus distance.
- CameraModule: Chooses the camera module (e.g.
Front,Back, orBackWidest). Note: TheBackWidesttype is iOS only.
- BackgroundColor: Sets the background color of the view. Default is
-
Functions
- StartDetection: Starts the detection of barcodes, while the camera is still on.
- StopDetection: Stops the detection of barcodes, while the camera is still on.
- StartScanAndCount: Begins the process of scanning and counting barcodes. It freezes the camera on current frame, Shows a captured frame with highlighted barcodes.
- ContinueScanning: Resumes the camera and prepares for another scan and count operation, without resetting the current barcodes count.
-
Event Handlers
- OnBarcodeScanResult: Subscribe to this event to receive the Barcodes scan result.
- OnScanAndCountFinished: Event triggered when the scan and count process is complete.
- OnBarcodeScanningError: Subscribe to this event to receive failures occurred while barcode scanning.
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
