BarcodeCapture .NET MAUI Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The BarcodeCapture API changes significantly between major SDK versions — properties get renamed, removed, or restructured. The .NET MAUI binding adds platform-specific lifecycle and handler concerns on top of the regular .NET API, so patterns from the standalone barcode-capture-net-android / barcode-capture-net-ios skills do not always apply.
Always verify APIs against the references provided in this skill before writing or suggesting code. Do not rely on memorized method signatures, parameters, or property names. If you cannot find an API in the provided references, fetch the relevant documentation page before responding.
MAUI-specific gotchas worth flagging:
- This skill targets MAUI apps with
<UseMaui>true</UseMaui>. For non-MAUI .NET projects, usebarcode-capture-net-androidorbarcode-capture-net-iosinstead. - Fetch the SDK version from NuGet before editing the
.csproj. WebFetchhttps://www.nuget.org/packages/Scandit.DataCapture.Barcode.Maui/and read the latest stable version off the page (skip-beta.*/-preview.*/-rc.*suffixes). Do not guess — versions from training data are stale anddotnet restorewill fail withNU1103if the pinned version isn't published. Use the same version for all four packages. - Android
SupportedOSPlatformVersionmust be ≥24. The MAUI template defaults to21, which is below Scandit's Android AAR minimum and fails the build withuses-sdk:minSdkVersion 21 cannot be smaller than version 24 declared in library. Bump the.csprojvalue to24.0(or higher) as part of the integration. - Required NuGet packages:
Scandit.DataCapture.Core,Scandit.DataCapture.Core.Maui,Scandit.DataCapture.Barcode,Scandit.DataCapture.Barcode.Maui. All four are needed — Core/Barcode provide the platform bindings, Core.Maui/Barcode.Maui provide the MAUI builder extensions and handlers. MauiProgram.csbuilder chain is specific and the order matters:builder .UseMauiApp<App>() .UseScanditCore(configure => configure.AddDataCaptureView()) .UseScanditBarcode();UseScanditBarcode()takes no inner configure — there is no MAUI handler for BarcodeCapture itself, the call exists only to invokeScanditBarcodeCapture.Initialize(). Do not writeUseScanditBarcode(configure => configure.AddBarcodeCaptureView())— that method does not exist.BarcodeCapturedoes not have a pre-built MAUI view (unlikeBarcodeArView,BarcodeCountView,BarcodeFindView,BarcodePickView,SparkScanView). The MAUI integration uses the generic<scandit:DataCaptureView>fromScandit.DataCapture.Core.UI.Mauiand aBarcodeCaptureOverlayis added on top.- XAML namespace for
DataCaptureViewisxmlns:scandit="clr-namespace:Scandit.DataCapture.Core.UI.Maui;assembly=ScanditCaptureCoreMaui".DataCaptureContext="{Binding DataCaptureContext}"is mandatory on the<scandit:DataCaptureView>element — without it the preview renders as a black/blank camera at runtime even though the code-behind compiles and the camera is started. Settingx:Name="dataCaptureView"is not enough; the bindable property is what wires the context to the preview. The page'sBindingContext(view model orthis) must expose aDataCaptureContextproperty of typeScandit.DataCapture.Core.Capture.DataCaptureContext. - The
BarcodeCaptureOverlaymust be created after the platform handler has been attached. The pattern used in the official sample is:
Creating the overlay beforethis.dataCaptureView.HandlerChanged += (s, e) => { var overlay = BarcodeCaptureOverlay.Create(this.viewModel.BarcodeCapture); this.dataCaptureView.AddOverlay(overlay); };HandlerChangedfires will fail silently — there is no native view to attach it to yet. - MAUI page lifecycle:
OnAppearing→ start the camera;OnDisappearing→ stop the camera. The official sample factors this into aResumeAsync/SleepAsyncpattern on the view model. - UI dispatch is
MainThread.BeginInvokeOnMainThread(() => …)— notRunOnUiThread(Android-specific) and notDispatchQueue.MainQueue.DispatchAsync(iOS-specific). The dispatch wrapper is platform-agnostic. MainThread.StartTimerdoes not exist.StartTimeris an extension onIDispatcher. To re-enable scanning after a delay, useawait Task.Delay(...)inside aMainThread.BeginInvokeOnMainThread(async () => …)lambda, or callDispatcher.StartTimer(...)/Application.Current.Dispatcher.StartTimer(...). See the "Re-enabling after a delay" section in references/integration.md.- Camera permission: use
await Permissions.CheckStatusAsync<Permissions.Camera>()andawait Permissions.RequestAsync<Permissions.Camera>(). MAUI's permission system also takes care of the underlyingAndroidManifest/Info.plistentries — but on iOS the project still needs theNSCameraUsageDescriptionstring set inInfo.plist. On Android, MAUI addsandroid.permission.CAMERAautomatically whenPermissions.Camerais requested at build time (it can also be added toPlatforms/Android/AndroidManifest.xmlexplicitly). - The .NET API uses PascalCase factories:
BarcodeCapture.Create(context, settings),BarcodeCaptureSettings.Create(),BarcodeCaptureOverlay.Create(barcodeCapture, view)orBarcodeCaptureOverlay.Create(barcodeCapture),DataCaptureContext.ForLicenseKey(key),Camera.GetCamera(CameraPosition.WorldFacing)orCamera.GetDefaultCamera(). - Symbology names are C# PascalCase:
Symbology.Ean13Upca,Symbology.Ean8,Symbology.Code128,Symbology.InterleavedTwoOfFive,Symbology.Qr,Symbology.DataMatrix. - The capture mode's enabled property is
barcodeCapture.Enabled(notIsEnabledorisEnabled). CodeDuplicateFilterisTimeSpan— notTimeInterval. UseCodeDuplicate.DefaultDuplicateFilter,CodeDuplicate.ReportDataAndSymbologyOnlyOnce,TimeSpan.FromMilliseconds(500),TimeSpan.FromSeconds(2.5), orTimeSpan.Zero.BarcodeCapture.RecommendedCameraSettingsis a static property, applied withcamera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings).- The official MAUI sample wires up the event-based API (
barcodeCapture.BarcodeScanned += handler). Prefer that overIBarcodeCaptureListenerin MAUI view-model code — it is the idiomatic C# pattern. The interface still works if the user prefers it. - Displaying the scan result: call
await this.DisplayAlertAsync(title, message, "OK")— the method name ends inAsync. The non-AsyncDisplayAlert(string, string, string)overload is obsolete in MAUI 9 and producesCS0618; both overloads compile, so the deprecation is easy to miss if you reuse pre-MAUI-9 snippets. Prefer this (or theIMessageServicewrapper used by the official sample) over inventing aLabel/VerticalStackLayouton the page. The awaited alert blocks until dismissal, which is the natural point to re-enable scanning (barcodeCapture.Enabled = true). See "Displaying the scan result to the user" in references/integration.md for both the inline and the injectableIMessageServicepatterns. - iOS frame-data disposal note: when the MAUI app is running on iOS,
frameData.Dispose()should still be called insideOnBarcodeScannedif the project uses theIBarcodeCaptureListenerinterface. The official sample uses the event API and does not dispose the frame explicitly there because the event-args lifetime is managed by the SDK — if disposing inside the event handler, do it in atry/finallyblock so a thrown exception cannot leave a frame undisposed.
Intent Routing
Based on the user's request, load the appropriate reference file before responding:
- Integrating BarcodeCapture from scratch, configuring settings, customizing feedback, adding a viewfinder, handling scans, or doing async work after a scan (e.g. "add BarcodeCapture to my MAUI app", "set up barcode scanning in MAUI", "how do I use Scandit BarcodeCapture in MAUI", "filter duplicate scans", "suppress the beep", "add a viewfinder", "disable scanning while I look up the barcode", "where do I create the BarcodeCaptureOverlay in MAUI") → read references/integration.md and follow the instructions there.
- Migrating or upgrading an existing BarcodeCapture integration (e.g. "upgrade from v6 to v7", "migrate my BarcodeCapture", "bump the Scandit .NET MAUI SDK to v8", "what changed between SDK versions") → read references/migration.md and follow the instructions there.
- Replacing a third-party barcode scanner with BarcodeCapture (e.g. "replace my ZXing.Net.Maui scanner with BarcodeCapture", "migrate from BarcodeScanning.Native.Maui to Scandit", "switch from [library] to BarcodeCapture") → read references/third-party-migration.md and follow the instructions there.
API Usage Policy
Only use APIs that are explicitly documented in the Scandit references below. Do not invent or guess method signatures, parameters, or property names. If unsure whether an API exists or how it is called — or if a compile error occurs — fetch the relevant reference page before responding. Do not tell the user to check the docs themselves. After answering, always include the relevant link so the user can explore further.
Never construct or guess documentation URLs. When you need a specific class or property's API page:
- First check whether the page you already fetched contains a direct hyperlink to it — topic pages link directly to relevant API symbols. Always request links alongside content in your fetch prompt.
- If no direct link was found, fetch the API index (see Full API reference in the table below), extract the actual link from it, and follow that.
URL structures can vary (e.g. api/ui/ subdirectory) and guessing will lead to 404s.
References
Direct users to the right resource based on their question:
| Topic | Resource |
|---|---|
| Get Started (Android target) | Get Started (.NET for Android) |
| Get Started (iOS target) | Get Started (.NET for iOS) |
| Advanced topics (custom feedback, viewfinders, location selection, scan intention, composite codes) | Android Advanced Configurations · iOS Advanced Configurations |
| Migration between major SDK versions | Android 6 → 7 · Android 7 → 8 · iOS 6 → 7 · iOS 7 → 8 |
| Full API reference | BarcodeCapture API (.NET Android) · BarcodeCapture API (.NET iOS) |
Scandit publishes the .NET API reference per underlying TFM (
dotnet.androidanddotnet.ios). For MAUI projects, both pages apply — the API surface is identical between them, but platform-specific notes (like iOS frame-data disposal) are documented on the per-TFM page.
API surface this skill covers
All classes documented as :available: dotnet.android and :available: dotnet.ios in the official RST docs are addressed in references/integration.md:
BarcodeCapture—Create(context, settings),Create(settings),Enabled,PointOfInterest,Feedback,BarcodeCaptureLicenseInfo,Context, staticRecommendedCameraSettings,ApplySettingsAsync,AddListener/RemoveListener, eventsBarcodeScanned/SessionUpdated.BarcodeCaptureSettings—Create(),EnableSymbology,EnableSymbologies(ICollection<Symbology>),EnableSymbologies(CompositeType),GetSymbologySettings,EnabledSymbologies,EnabledCompositeTypes,CodeDuplicateFilter,LocationSelection,BatterySaving,ScanIntention,SetProperty/GetProperty<T>/TryGetProperty<T>.BarcodeCaptureFeedback— staticDefaultFeedback,Success.BarcodeCaptureSession—NewlyRecognizedBarcode,NewlyLocalizedBarcodes,FrameSequenceId,Reset().IBarcodeCaptureListener—OnObservationStarted,OnObservationStopped,OnBarcodeScanned,OnSessionUpdated.BarcodeCaptureEventArgs—BarcodeCapture,Session,FrameData.BarcodeCaptureLicenseInfo—LicensedSymbologies.BarcodeCaptureOverlay—Create(barcodeCapture, view),Create(barcodeCapture),Brush, staticDefaultBrush,Viewfinder,ShouldShowScanAreaGuides,SetProperty.- MAUI-specific glue:
MauiAppBuilder.UseScanditCore(configure => configure.AddDataCaptureView()),MauiAppBuilder.UseScanditBarcode(),<scandit:DataCaptureView>XAML control,dataCaptureView.HandlerChangedevent,dataCaptureView.AddOverlay(overlay), MAUIPermissions.Camera,MainThread.BeginInvokeOnMainThread.