SparkScan .NET MAUI Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The SparkScan API changes between major SDK versions — button-visibility / color properties get renamed, removed, or restructured. The .NET binding also uses different naming conventions than the Kotlin / Swift native SDKs (PascalCase, Enabled instead of isEnabled, TimeSpan instead of TimeInterval, etc.), and the MAUI control has its own quirks that are separate from both the BarcodeCapture MAUI integration and the non-MAUI .NET-Android / .NET-iOS SparkScan integrations.
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 is for MAUI apps (
<UseMaui>true</UseMaui>in the.csproj). If the project does not have<UseMaui>true</UseMaui>, use thesparkscan-net-androidorsparkscan-net-iosskill instead — those cover the non-MAUI .NET Android / .NET iOS workloads. - The MAUI builder chain for SparkScan is different from the BarcodeCapture MAUI builder chain. SparkScan uses
.UseScanditCore().UseScanditBarcode(configure => configure.AddSparkScanView())—UseScanditCoretakes noconfigurelambda andUseScanditBarcodedoes take a configure lambda withAddSparkScanView()inside it. This is the opposite shape of the BarcodeCapture builder, which is.UseScanditCore(c => c.AddDataCaptureView()).UseScanditBarcode()(Core takes a configure lambda; Barcode takes none). Do not cross-pollinate — if you see a BarcodeCapture MAUI sample online withUseScanditCore(c => c.AddDataCaptureView()).UseScanditBarcode(), that pattern is correct for BarcodeCapture only. For SparkScan, the builder line must read.UseScanditCore().UseScanditBarcode(c => c.AddSparkScanView()). Cross-reference the BarcodeCapture MAUI skill if both modes coexist in the same app — both registrations are needed in that case. AddDataCaptureView()is not needed for SparkScan. SparkScan has its own pre-built MAUI handler (<scandit:SparkScanView>) — it does not use the generic<scandit:DataCaptureView>. CallingUseScanditCore(c => c.AddDataCaptureView())on a SparkScan-only project is harmless but unnecessary; the simplerUseScanditCore()is what the official sample uses.- XAML namespace is
clr-namespace:Scandit.DataCapture.Barcode.Spark.UI.Maui;assembly=ScanditBarcodeCaptureMaui. Note:assembly=ScanditBarcodeCaptureMaui(no dots in the assembly name) — the NuGet package isScandit.DataCapture.Barcode.Mauibut the assembly it produces isScanditBarcodeCaptureMaui. Easy to get wrong if you just copy the package id. <scandit:SparkScanView>requires three bindable properties:DataCaptureContext,SparkScan,SparkScanViewSettings. Without all three bound, the preview is black and scanning never starts. There is also an optionalFeedbackbindable property for theISparkScanFeedbackDelegate. The MAUI control is a pre-builtView, not the generic<scandit:DataCaptureView>— for SparkScan there is no separate camera preview, overlay, or context-view wiring to do.- MAUI lifecycle for the SparkScan control is
OnAppearing()/OnDisappearing()— called on the control, not just the page. Forward the page'sOnAppearing/OnDisappearingintothis.SparkScanView.OnAppearing()/this.SparkScanView.OnDisappearing(). These are MAUI-specific methods on the SparkScan MAUI control — they don't exist on the non-MAUI dotnet.android / dotnet.ios bindings (which useOnPause/OnResumeandPrepareScanning/StopScanningrespectively). SparkScanandSparkScanSettingsuse plainnewconstructors, notCreate(...)factories. This is unusual compared to the rest of the .NET API (BarcodeCapture.Create(...),BarcodeCaptureSettings.Create()). The canonical pattern isvar settings = new SparkScanSettings(); var sparkScan = new SparkScan(settings);— writingSparkScan.Create(...)orSparkScanSettings.Create()is a compile error.DataCaptureContext.ForLicenseKey(key)still uses the factory form (it lives in Core, not Spark).- The .NET
ISparkScanListenerhas only two methods:OnBarcodeScanned(SparkScan, SparkScanSession, IFrameData?)andOnSessionUpdated(SparkScan, SparkScanSession, IFrameData?). There are noOnObservationStarted/OnObservationStoppedmethods (the wayIBarcodeCaptureListenerhas them). - Prefer the event API (
sparkScan.BarcodeScanned += handler) over the listener interface in idiomatic C#. The official MAUI SparkScan sample wires the event on the view model. The handler receivesSparkScanEventArgswithSession,FrameData, andSparkScan. - Symbology names are C# PascalCase:
Symbology.Ean13Upca,Symbology.Ean8,Symbology.Code128,Symbology.InterleavedTwoOfFive,Symbology.Qr,Symbology.DataMatrix. - The capture mode's enabled property is
sparkScan.Enabled(notIsEnabled). CodeDuplicateFilter,TriggerButtonCollapseTimeout,InactiveStateTimeout,SparkScanBarcodeErrorFeedback.resumeCapturingDelayare allTimeSpan— notTimeInterval.SparkScanSettingsdoes not exposeCodeDuplicate.DefaultDuplicateFilter/ReportDataAndSymbologyOnlyOncesentinels — those live onBarcodeCaptureSettings. For SparkScan, set theTimeSpandirectly.- Feedback is delivered through
ISparkScanFeedbackDelegate.GetFeedbackForBarcode(Barcode)and assigned withthis.SparkScanView.Feedback = thisfrom the page code-behind (wherethisimplementsISparkScanFeedbackDelegate). Returningnullfrom the delegate falls back to the default success feedback.- Success feedback:
new SparkScanBarcodeSuccessFeedback()(default), or pass(Color),(Color, Brush), or(Color, Brush, Feedback?). - Error feedback:
new SparkScanBarcodeErrorFeedback(message: "...", resumeCapturingDelay: TimeSpan.FromSeconds(60)). The view shows the error message, the trigger button shows an error state, and scanning resumes after the delay.
- Success feedback:
GetFeedbackForBarcode(Barcode)is invoked on a background thread. Build the feedback objects once (in the page constructor orOnAppearing) and return cached instances.SparkScan.BarcodeScanned(andISparkScanListener.OnBarcodeScanned) also run on a background thread. Dispatch UI updates viaMainThread.BeginInvokeOnMainThread(() => { … }).MainThread.StartTimerdoes not exist —StartTimeris onIDispatcher(Dispatcher.StartTimer(...)/Application.Current.Dispatcher.StartTimer(...)).- Four NuGet packages are required:
Scandit.DataCapture.Core,Scandit.DataCapture.Core.Maui,Scandit.DataCapture.Barcode,Scandit.DataCapture.Barcode.Maui. All four must be pinned to the same version. Fetch the latest stable version fromhttps://www.nuget.org/packages/Scandit.DataCapture.Barcode.Maui/— skip-beta/-preview/-rcsuffixes. Versions from training data are stale. - Android
SupportedOSPlatformVersionmust be ≥24.0— the MAUI template's default is21.0, which fails the build because Scandit's Android AAR hasminSdkVersion=24. iOS minimum is15.0(matches the MAUI template default). - iOS
NSCameraUsageDescriptioninPlatforms/iOS/Info.plistis mandatory. Without it the app crashes on first camera access. Android relies onPermissions.Camera(MAUI adds the manifest entry automatically when the permission is requested at build time) or you can add<uses-permission android:name="android.permission.CAMERA" />toPlatforms/Android/AndroidManifest.xmlexplicitly. - The MAUI sample does not call
ScanditCaptureCore.Initialize()/ScanditBarcodeCapture.Initialize()directly —UseScanditCore()andUseScanditBarcode(...)invoke them as part of the builder chain. Do not add a separateInitialize()call inMainApplication.cs/AppDelegate.cson top of the builder — it is redundant in MAUI. - MAUI single-file
Platforms/Android/MainApplication.csandPlatforms/iOS/AppDelegate.csare the standard MAUI shims that callMauiProgram.CreateMauiApp(). Do not override theirOnCreate/FinishedLaunchingwith manual Scandit initialization — that's a non-MAUI pattern. SparkScanScanningModeDefaultandSparkScanScanningModeTargetare constructed withnew, both taking(SparkScanScanningBehavior, SparkScanPreviewBehavior). There is no parameterless constructor.- View state is exposed via
SparkScanView.ViewStateChanged(event ofEventHandler<SparkScanViewStateEventArgs>) — use the eventsBarcodeCountButtonTapped,BarcodeFindButtonTapped,LabelCaptureButtonTapped, andViewStateChanged. - Hardware trigger:
SparkScanViewSettings.HardwareTriggerEnabledis available cross-platform in MAUI but only has effect on Android.HardwareTriggerKeyCodeis Android-only in the .NET binding — it is wrapped in#if __ANDROID__and not visible to cross-platform MAUI code. For cross-platform code, only setHardwareTriggerEnabledand rely on the default key code.
Intent Routing
Based on the user's request, load the appropriate reference file before responding:
- Integrating SparkScan from scratch, configuring settings, customizing feedback, customizing the SparkScanView appearance, handling scans, MVVM wiring, or doing async work after a scan (e.g. "add SparkScan to my MAUI app", "set up barcode scanning in MAUI", "how do I use SparkScan in net-maui", "reject barcodes with error feedback", "hide the torch button", "show a custom toast on scan", "use target mode", "bind SparkScan to my view model") → read references/integration.md and follow the instructions there.
- Migrating or upgrading an existing SparkScan MAUI integration (e.g. "upgrade from v6 to v7", "migrate my MAUI SparkScan", "bump the Scandit .NET SDK to v8", "what changed between SDK versions") → read references/migration.md and follow the instructions there.
- Replacing a third-party barcode scanner with SparkScan in MAUI (e.g. "replace my ZXing.Net.Maui scanner with SparkScan", "migrate from BarcodeScanning.Native.Maui to Scandit", "switch from [library] to SparkScan in MAUI") → 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 for both TFMs), 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 | Get Started (.NET MAUI) |
| Advanced topics (custom feedback, scanning modes, UI customization, toast messages) | Advanced Configurations (.NET Android) · (.NET iOS) — MAUI shares both TFMs |
| Migration between major SDK versions | Android: 6 → 7 · 7 → 8 · iOS: 6 → 7 · 7 → 8 |
| Full API reference | SparkScan API (.NET Android) · SparkScan API (.NET iOS) |
MAUI inherits the per-TFM .NET API. There is no separate "dotnet.maui" doc filter — pick the .NET Android or .NET iOS API reference depending on which TFM you're debugging against. The MAUI-specific surface is just the XAML control, the builder extensions, and the
OnAppearing/OnDisappearinglifecycle methods.
API surface this skill covers
All classes documented with :available: dotnet.android and / or :available: dotnet.ios in the official RST docs (docs/source/barcode-capture/api/spark-scan*.rst and api/ui/spark-scan-*.rst) are addressed in references/integration.md, plus the MAUI-specific surface:
Cross-platform Spark API (same as the per-TFM skills):
SparkScan—new SparkScan(),new SparkScan(SparkScanSettings),Enabled,ApplySettingsAsync,AddListener/RemoveListener, eventsBarcodeScanned/SessionUpdated,SparkScanLicenseInfo,Dispose.SparkScanSettings—new, symbology APIs,CodeDuplicateFilter,BatterySaving,ScanIntention, property bag.SparkScanSession—NewlyRecognizedBarcode,FrameSequenceId,Reset().SparkScanEventArgs—SparkScan,Session,FrameData.ISparkScanListener—OnBarcodeScanned,OnSessionUpdated.SparkScanLicenseInfo—LicensedSymbologies.- Feedback:
SparkScanBarcodeFeedback,SparkScanBarcodeSuccessFeedback,SparkScanBarcodeErrorFeedback(message, resumeCapturingDelay, …),ISparkScanFeedbackDelegate.GetFeedbackForBarcode(Barcode). SparkScanViewSettings—TriggerButtonCollapseTimeout,DefaultScanningMode,DefaultTorchState,SoundEnabled,HapticEnabled,HoldToScanEnabled,HardwareTriggerEnabled,ZoomFactorOut,ZoomFactorIn,ToastSettings,VisualFeedbackEnabled,InactiveStateTimeout,DefaultCameraPosition,DefaultMiniPreviewSize,SmartSelectionCandidateBrush.SparkScanToastSettings—ToastEnabled,ToastBackgroundColor,ToastTextColor, plus message strings.SparkScanViewStateenum,SparkScanViewEventArgs,SparkScanViewStateEventArgs.SparkScanMiniPreviewSize,SparkScanPreviewBehavior,SparkScanScanningBehaviorenums.ISparkScanScanningMode,SparkScanScanningModeDefault,SparkScanScanningModeTarget.
MAUI-only surface (assembly
ScanditBarcodeCaptureMaui):Scandit.DataCapture.Barcode.Maui.MauiAppBuilderExtensions.UseScanditBarcode(this MauiAppBuilder, Action<ConfigureBarcode>)— the configure lambda exposesAddSparkScanView().Scandit.DataCapture.Core.Maui.MauiAppBuilderExtensions.UseScanditCore(this MauiAppBuilder)— no configure lambda is needed for a SparkScan-only app.Scandit.DataCapture.Barcode.Spark.UI.Maui.SparkScanView— the MAUIViewcontrol with bindable propertiesDataCaptureContext,SparkScan,SparkScanViewSettings,Feedback, plus instance methodsOnAppearing(),OnDisappearing(),StartScanning(),PauseScanning(),ShowToast(string), and the full set of cross-platform button-visibility / color / image properties and events inherited from the underlying SparkScan view.