Developer’s Guide to Adding a .NET Barcode Scanner API

| Developers

Building or selecting an enterprise-grade .NET barcode scanner API for iOS, Android, and MAUI apps requires more than basic image capture and processing. UX principles and performance requirements are important too.

With user adoption and longevity key goals for your app, the last things you want are user complaints because the scanner doesn’t perform under real-world business conditions.

This blog explains the UX and performance considerations that lead to successful barcode scanner implementations for enterprises. Later below, we provide a getting-started tutorial for adding scanning features using the Scandit SparkScan .NET Barcode Scanner SDK, a pre-built barcode scanning component that adds a minimalistic UI on top of any iOS, Android, or MAUI application.

To create a .NET barcode scanner, we’ll walk through these steps:

  • Add the SparkScan SDK for .NET to your project.
  • Create a Data Capture Context instance.
  • Change supported symbologies for your use case.
  • Change the scanning mode.
  • Customize the user interface.
  • Register a listener for new barcode scans.

If you want a head start, download and run one of our iOS, Android, or MAUI barcode scanning samples on your development device now.

Why UX matters for .NET-based barcode scanning

Like staying within the memory and battery life limitations of all the devices you support, integrating a .NET barcode scanner library can be time-consuming and frustrating. Avoiding the risk of burdening users with performance issues and hard-to-use features ultimately leads to improved adoption rates and happier employees.

Our blog on how barcode scanners work explains the technical complexities behind scanning that can lead to integration and usability challenges.

There are numerous UX considerations to consider, ranging from assistance features to ease of use. Knowing what to implement up front brings you happier users down the road.

PDF417 with DataMatrix with SparkScan

Start barcode scanning with .NET

Add enterprise-class .NET barcode scanning in minutes

A good barcode scanner needs more than a good camera

Good UX design creates a positive experience for users, leading to increased engagement and user satisfaction.

For applications like barcode scanners, environmental conditions and varying levels of user skills can compromise the precision and accuracy necessary for effective captures. Proper navigation, interaction, and feedback help users do their jobs, and gaps in these areas lead quickly to frustration, dissatisfaction, and complaints.

The following video shows how you can build rich, user-friendly UIs using SparkScan for .NET. You don’t have to worry about UX design with this library and can configure controls to work with the existing layout of your .NET app.

This example shows a collapsed floating button that users swipe or tap to open a camera preview for barcode scanning. They can then adjust the preview’s location to directly behind the hardware camera for more accurate aiming and capture.

Understanding the following UX workflows helps build the best barcode scanner experience for your user base.

Starting the scanner

Mobile device users have enough on their plates without worrying about complex menu navigation or waiting for a barcode scanner to start. Good UX requires a fast and seamless transition into scanning mode, no matter what the user is doing with their device.

Helping with aiming the camera

Aiming a camera can be difficult in environments where the barcode is hard to reach, or mixed in with other barcodes the user doesn’t want to scan. Building UX elements into your app that make selecting barcodes easier helps improve user efficiency and satisfaction.

Two examples of these types of elements are:

  • A viewfinder that tells users when scanning is active and helps them position the camera over the barcode correctly.
  • Restricting the scan area to help users focus on the correct barcode amidst a variety of barcodes and reduce the processing overhead on low-end devices.

SparkScan for .NET includes sophisticated algorithms for context-based AI scanning. Called Smart Scan Intention, these algorithms analyze contextual data, such as device movement and barcode characteristics, to capture the correct barcode even with imprecise aiming. This reduces unwanted scans by up to 100%.

Feedback and assistance

Your .NET barcode scanner implementation should provide immediate and unambiguous feedback on the success or failure of a scan. A slow response leads to user frustration. Unclear results may also lead to inaccurate and potentially noncompliant data for the business.

A combination of techniques can be used to help the user scan successfully, such as:

  • Playing audio and triggering haptic feedback when a barcode capture is successful.
  • Drawing a brush overlay at the location of the detected barcode to confirm that the intended item was scanned by the app.

Providing options for single and multiple barcode scans

Features that allow the user to switch between scanning single and multiple barcodes help them work more efficiently. Environments where the number or configuration of barcodes varies, such as a warehouse or retail store, can slow down employees if they are forced to scan one barcode at a time.

SparkScan has two modes built into its .NET barcode scanner SDK:

  • Single scan: The user triggers the scanner for every barcode, providing greater control over the scanning experience.
  • Continuous scan: The user triggers the scanner once and the app scans multiple barcodes without further interaction, reducing user fatigue.

Which .NET barcode scanner API is best?

Here are some other considerations to think about when building your barcode scanner for iOS, Android, and MAUI applications.

1. Performance

Regardless of the device and version, you should consider the following performance requirements for your app and test cases:

  • Accuracy: Barcode scanning for high-volume operations, such as inventory management, asset tracking, and last-mile delivery, requires an implementation that accurately decodes barcodes with few or no errors. Even a 95% success rate is unlikely to be good enough – you should be looking for greater than 99% success. To achieve these goals, select barcode scanning software that captures the right data on every scan and reduces the number of unwanted scans.
  • Speed: A barcode scanner that helps users capture and process barcodes fast means accelerated business operations.
  • Scanning barcodes in degraded conditions: A barcode may be torn, obscured, crumpled, under low light, or wrapped in plastic, so your solution should account for all these scenarios.
  • Camera start-up time: To avoid frustrated users and slower operations, your barcode scanner should support a “standby state” that minimizes camera start-up delays between scans.
  • Capturing multiple barcodes fast: Users may need to scan multiple barcodes at once or in quick succession, such as a worker in a fulfillment center required to scan a product barcode and a location barcode fast to meet shipping times. Libraries that can scan multiple barcodes, such as Scandit MatrixScan, identify and track multiple barcodes without getting confused by device movement or duplicates.
  • Field-of-view and distance: Scanners must handle barcodes on items of various sizes, shapes, and distances from the camera. A library supporting scanning ranges from tiny barcodes and electronic shelf labels (ESL) to large shipping labels eliminates the workarounds you need to implement to handle real-world label sizes.
  • Multi-modal data capture: A .NET scanning library that can extract barcode and text data simultaneously reduces scan times and the errors associated with entering data manually. Scandit’s SDK includes multi-modal data capture, making data entry up to seven times faster than scanning labels separately.

For advice on achieving these requirements, read:

2. Device support

Enterprises often have a diverse fleet of employee devices with different camera specifications and processor architectures — especially in Bring-Your-Own-Device (BYOD) situations.

Your barcode scanner must be architected and designed to perform on platforms ranging from the latest smartphone model to legacy hardware. (You can see SparkScan’s system requirements here.)

We list key performance tests below to gauge how well your solution performs.

A solution should be highly optimized for processor performance and resource loading, and make efficient use of background tasks. SparkScan, for example, is built on a C/C++ foundation, ensuring that the core barcode scanning features are loaded efficiently in the background and consume minimal system resources.

3. Support for different development frameworks

For developers working in different environments, you may need to provide support for different platforms and frameworks. Scandit’s barcode scanning products are available for Native iOS, Native Android, Cordova, Xamarin and Xamarin.Forms, React Native, JavaScript, Flutter, Capacitor, and Titanium.

4. Advanced scanning features

There will come a time when users request new ways of using their barcode scanner and speeding up their workflows. They may want more assistance from their user interface or the ability to capture multiple barcodes simultaneously.

To meet these needs, look to libraries that either come with these features out of the box or are extensible to include them. For example, Scandit’s .NET barcode scanning library includes these features:

  • Smart Label Capture to embed multi-modal data capture that reads barcodes and printed text simultaneously. This helps extract data up to 7 times faster for labels containing different items such as serial numbers, weights, and expiry dates.
  • Multiple barcode scanning with MatrixScan to batch scan multiple codes simultaneously, without losing track of them as users move their devices. This reduces the time and effort needed for inventory counts, last-mile delivery, picking and packing, and other high-volume barcode scenarios.
  • Augmented reality (AR) with MatrixScan Find to help users find the correct item among many items with minimal effort.

5. Open-source .NET barcode scanner libraries

Many .NET developers choose open-source barcode reader libraries for their ease of access and cost-effectiveness, thinking they only need basic features. The tradeoff comes when users try to use them in the real world, where speed and accuracy are critical, and where barcodes are placed in difficult-to-scan environments.

If you’re supporting a business-critical environment like a warehouse, retail stockroom, or last-mile delivery, an open-source .NET barcode reader library may not be the best choice. The overall performance of your app is only as strong as its slowest component.

Open-source barcode scanner SDKs tend not to perform as well as commercial libraries. Commercial barcode scanner SDKs that are high-performance, accurate, and built to operate under difficult situations are often better suited for demanding enterprise use cases.

6. Support

For an enterprise-level barcode scanner, look for these artifacts and services to ensure a risk-free deployment:

  • Code samples to help you get started and familiarize yourself with the APIs.
  • Documentation that includes tutorials and API reference guides.
  • Regular updates (check the release notes) to ensure you have the latest features, bug fixes, and security patches.
  • Options for technical help from developers familiar with the software and its users.

Scandit’s Enterprise-Level Success Team helps you go from trial evaluation to day-to-day barcode scanning operations with users. They can ensure barcode scanning integrates smoothly into your .NET app and is optimized for your business.

7. Security and privacy

At a minimum, your barcode scanner software must comply with your organization’s security and privacy policies and with the applicable standards for your industry. This often means the library must protect data in transit and at rest.

Scandit takes a security by design approach to all software, where you have complete control over data collection and processing. This means:

  • All image processing happens on the device to ensure confidentiality and high availability of scanning.
  • Any data you choose to share with Scandit is encrypted during transit and at rest.
  • Scandit is ISO 27001:2022 Certified and compliant with applicable privacy regulations that include GDPR and CCPA.
Close up damaged label with SparkScan boxes on shelves

BARCODE SCANNING IN .NET MADE EASY

Integrate with just a few lines of code or use our samples

How do I create a barcode scanner in .NET?

SparkScan allows developers to add pre-built and intuitive barcode scanner capabilities to any iOS, Android, and MAUI application.

The SparkScan .NET barcode scanner API is built upon well-researched UX principles and optimized using feedback from thousands of Scandit customers across various environments.

It provides a pre-built scanning interface with a minimalistic UI that floats on top of any app. This reduces your development time and addresses common scanning pitfalls such as low light, torn labels, and long scanning distances.

SparkScan’s interface consists of a small camera preview window and a large, moveable, semi-transparent trigger button that can be dragged to the most ergonomic position. When not in use, the preview window disappears and the trigger button collapses to occupy minimum space on the user’s screen.

The next sections explain how to implement a customizable barcode scanning interface for iOS, Android, and MAUI in just a few steps with the Scandit .NET Barcode Scanner SDK.

Get started with SparkScan for .NET

Follow these SparkScan instructions to add pre-built barcode scanning features to your app:

These sections also include instructions for developing MAUI applications.

.NET for iOS

Follow these steps to add barcode scanning and pre-built UI components using SparkScan to your iOS app. For additional help and examples of how to integrate barcode scanning:

The prerequisites for these steps are:

  • The latest stable version of Visual Studio.
  • A .NET SDK.
  • A .NET for iOS project with a minimum iOS deployment target of 14.0 or higher.
  • A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.

Although not covered here, the Scandit .NET Barcode Scanner SDK also supports scanning multiple barcodes at once (batch scanning). The instructions for setting up and using this capability are located in our Get Started With MatrixScan documentation.

1. Add the SDK

The Scandit Data Capture SDK is distributed as NuGet packages, which you get from the NuGet site.

You must add the Scandit.DataCapture.Core and Scandit.DataCapture.Barcode (the ScanditBarcodeCapture API) packages, which contain the functionality for barcode scanning. When developing a MAUI application, you also need to add the Scandit.DataCapture.Core.Maui package.

You must also consider:

  • Camera permissions: When using SparkScan, you must set the camera as the frame source for various capture modes. On .NET for iOS, you have to set the “Privacy – Camera Usage Description” field in the Info.plist file.
  • When using SparkScan SDK in a MAUI application, you have to request camera permissions in your own application before starting scanning. To see how you can achieve this, take a look at our samples.

2. Create a new Data Capture Context instance

To add capture capabilities to your application, you must create a new Data Capture Context, which expects a valid Scandit Data Capture SDK license key during construction:

DataCaptureContext dataCaptureContext = DataCaptureContext.ForLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");

3. Configure the SparkScan Mode

The SparkScan Mode is configured through SparkScanSettings, allowing you to register one or more listeners that are informed whenever a new barcode is scanned.

For this blog, we set up SparkScan for scanning EAN13 codes. Change this to the symbologies for your use case (for example, Code 128, Code 39).

SparkScanSettings settings = new SparkScanSettings();
HashSet<Symbology> symbologies = new HashSet<Symbology>()
{
    Symbology.Ean13Upca
};
settings.EnableSymbologies(symbologies);

Next, create a SparkScan instance with the settings initialized in the previous step:

SparkScan sparkScan = new SparkScan(settings);

4. Setup the SparkScan View

The SparkScan built-in user interface includes the camera preview and scanning UI elements. These guide the user through the scanning process.

The SparkScanView appearance can be customized through SparkScanViewSettings.

SparkScanViewSettings viewSettings = new SparkScanViewSettings();
// setup the desired appearance settings by updating the fields in the object above

Adding a SparkScanView automatically adds the scanning interface (camera preview and scanning UI elements) to your iOS application.

Next, add a SparkScan View to your view hierarchy by constructing a new SparkScan view. The SparkScan view is automatically added to the provided parentView:

SparkScanView sparkScanView = SparkScanView.Create(parentView, dataCaptureContext, sparkScan, viewSettings);

See Workflow Options for instructions on how to change the scanning mode, set camera preview behavior, and set the scanning behavior to either single scan or continuous scan.

When developing on MAUI, the SparkScan view must be added as the last item to AbsoluteLayout or RelativeLayout, to make sure other UI components are visible:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:scandit="clr-namespace:Scandit.DataCapture.Barcode.Spark.UI.Unified;assembly=ScanditBarcodeCaptureUnified">
  <ContentPage.Content>
    <AbsoluteLayout>
      <!-- Your other UI components comes here before SparkScanView -->
      <scandit:SparkScanView
        x:Name="SparkScanView"
        AbsoluteLayout.LayoutBounds="0,0,1,1"
        AbsoluteLayout.LayoutFlags="All"
        DataCaptureContext="{Binding DataCaptureContext}"
        SparkScan="{Binding SparkScan}"
        SparkScanViewSettings="{Binding ViewSettings}">
      </scandit:SparkScanView>
    </AbsoluteLayout>
  </ContentPage.Content>
</ContentPage>

To ensure start-up time is optimal and that scanning is stopped when the app goes into the background, call SparkScanView.ViewWillAppear() and SparkScanView.ViewWillDisappear() in your UIViewController’s ViewWillAppear and ViewWillDisappear callbacks:

public override void ViewWillAppear(bool animated)
{
    base.ViewWillAppear(animated);
    sparkScanView.ViewWillAppear();
}

public override void ViewWillDisappear(bool animated)
{
    base.ViewWillDisappear(animated);
    sparkScanView.ViewWillDisappear();
}

To ensure optimal start-up time when developing on MAUI, make sure to call SparkScanView.OnAppearing and SparkScanView.OnDisappearing in your Page.OnAppearing and Page.OnDisappearing callbacks:

protected override void OnAppearing()
{
    base.OnAppearing();
    this.SparkScanView.OnAppearing();
}

protected override void OnDisappearing()
{
    base.OnDisappearing();
    this.SparkScanView.OnDisappearing();
}

5. Register the listener to be informed when a new barcode is scanned

To keep track of the scanned barcodes, implement the ISparkScanListener interface and register the listener to the SparkScan mode.

// Register self as a listener to monitor the SparkScan session.
sparkScan.AddListener(this);

ISparkScanListener.OnBarcodeScanned() is called when a new barcode is scanned. This result is retrieved from the first object in the provided barcodes list: SparkScanSession.NewlyRecognizedBarcodes. Note that this list only contains one barcode entry.

public void OnBarcodeScanned(SparkScan sparkScan, SparkScanSession session, IFrameData? data)
{
if (session.NewlyRecognizedBarcode.Count == 0)
{
return;
}

// Gather the recognized barcode
Barcode barcode = session.NewlyRecognizedBarcode[0];

// This method is invoked from a recognition internal thread.
// Run the specified action in the UI thread to update the internal barcode list.
RunOnUiThread(() =>
{
// Update the internal list and the UI with the barcode retrieved above
this.latestBarcode = barcode;
});
}

Alternatively, to register ISparkScanListener interface, it is possible to subscribe to corresponding events. For example:

sparkScan.BarcodeScanned += (object sender, SparkScanEventArgs args) =>
{
if (args.Session.NewlyRecognizedBarcode.Count == 0)
{
return;
}

// Gather the recognized barcode
Barcode barcode = args.Session.NewlyRecognizedBarcode[0];

// This method is invoked from a recognition internal thread.
// Run the specified action in the UI thread to update the internal barcode list.
RunOnUiThread(() =>
{
// Update the internal list and the UI with the barcode retrieved above
this.latestBarcode = barcode;

// Emit sound and vibration feedback
this.sparkScanView.EmitFeedback(new SparkScanViewSuccessFeedback());
});
}

6. Customize the .NET iOS UI with advanced configurations

Using advanced configurations, you can customize the SparkScan UI and UX to suit your needs and use cases. These customizations include the colors of all UI items (i.e. icons, buttons, toolbar), trigger button icon, size of the preview window, and more.

The graphic below shows three different examples of how colors, positions, and sizes can be customized to fit different iOS apps.

Now your iOS app is ready to scan!

.NET for Android

Follow these steps to add barcode scanning and pre-built UI components using SparkScan to your Android app. For additional help and examples of how to integrate barcode scanning:

The prerequisites for these steps are:

  • The latest stable version of Visual Studio.
  • A .NET SDK.
  • A .NET for Android project with target SDK version 23 (Android 6, Marshmallow) or higher.
  • A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.

1. Add the SDK

SparkScan is part of the Scandit Data Capture SDK, which is distributed as AAR libraries in the official Scandit Maven repository.

You must add the Scandit.DataCapture.Core and Scandit.DataCapture.Barcode (the ScanditBarcodeCapture API) packages, which contain the functionality for barcode scanning.

1. To add SparkScan using Gradle

Add mavenCentral() repository to the build.gradle file:

repositories {
  mavenCentral()
}

Add the necessary artifacts as dependencies to the app’s build.gradle as required:

dependencies {
  implementation "com.scandit.datacapture:core:[version]"
  implementation "com.scandit.datacapture:barcode:[version]"
  
}

2. To add SparkScan using Maven

Add the mavenCentral repository to the pom.xml file:

<repositories>
  <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Central</name>
      <url>https://repo1.maven.org/maven2</url>
  </repository>
</repositories>

Add the necessary artifacts as dependencies as required:

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>core</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>barcode</artifactId>
  <version>[version]</version>
</dependency>

3. Additional steps and considerations

If you’re using the androidx.fragments dependency and experience a situation where a scanning fragment navigates to another scanning fragment with an incompatible mode, make sure you’re using version 1.3.0+ of the dependency.

If not, you may run into an incompatible modes error, as the new fragment gets resumed before the previous is paused and for some time, incompatible modes may be enabled in the DataCaptureContext simultaneously. This leads to empty results in sessions.

The Scandit SDK uses content providers to initialize scanning capabilities. If your content providers depend on the Scandit SDK, choose an initOrder lower than 10 to make sure the SDK is ready first. If not specified, initOrder is zero by default and you have nothing to worry about.

For more information, read the official Android <provider> documentation.

2. Create a new Data Capture Context instance

To add capture capabilities to your application, you must create a new Data Capture Context, which expects a valid Scandit Data Capture SDK license key during construction:

DataCaptureContext dataCaptureContext = DataCaptureContext.ForLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");

3. Configure the SparkScan Mode

The SparkScan Mode is configured through SparkScanSettings, allowing you to register one or more listeners that are informed whenever a new barcode is scanned.

For this blog, we set up SparkScan for scanning EAN13 codes. Change this to the symbologies for your use case (for example, QR Code, UPC Code).

SparkScanSettings settings = new SparkScanSettings();
HashSet<Symbology> symbologies = new HashSet<Symbology>()
{
    Symbology.Ean13Upca
};
settings.EnableSymbologies(symbologies);

Next, create a SparkScan instance with the settings initialized in the previous step:

SparkScan sparkScan = new SparkScan(settings);

4. Setup the SparkScan View

The SparkScan built-in user interface includes the camera preview and scanning UI elements. These guide the user through the scanning process.

The SparkScanView appearance can be customized through SparkScanViewSettings.

SparkScanViewSettings viewSettings = new SparkScanViewSettings();
// setup the desired appearance settings by updating the fields in the object above

Adding a SparkScanView automatically adds the scanning interface (camera preview and scanning UI elements) to your Android application.

Next, add a SparkScan View to your view hierarchy by constructing a new SparkScan view. The SparkScan view is automatically added to the provided parentView (preferably an instance of SparkScanCoordinatorLayout):

SparkScanView sparkScanView = SparkScanView.Create(parentView, dataCaptureContext, sparkScan, viewSettings);

See SparkScan Workflow Options for instructions on changing the scanning mode, set camera preview behavior, and set the scanning behavior to either single scan or continuous scan.

When developing on MAUI, the SparkScan view must be added as the last item to AbsoluteLayout or RelativeLayout, to make sure other UI components are visible:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:scandit="clr-namespace:Scandit.DataCapture.Barcode.Spark.UI.Unified;assembly=ScanditBarcodeCaptureUnified">
  <ContentPage.Content>
    <AbsoluteLayout>
      <!-- Your other UI components comes here before SparkScanView -->
      <scandit:SparkScanView
        x:Name="SparkScanView"
        AbsoluteLayout.LayoutBounds="0,0,1,1"
        AbsoluteLayout.LayoutFlags="All"
        DataCaptureContext="{Binding DataCaptureContext}"
        SparkScan="{Binding SparkScan}"
        SparkScanViewSettings="{Binding ViewSettings}">
      </scandit:SparkScanView>
    </AbsoluteLayout>
  </ContentPage.Content>
</ContentPage>

Additionally for MAUI, to ensure optimal start-up time and that scanning is stopped when the app goes into the background, make sure to call SparkScanView.OnAppearing and SparkScanView.OnDisappearing in your Page.OnAppearing and Page.OnDisappearing callbacks:

protected override void OnAppearing()
{
    base.OnAppearing();
    this.SparkScanView.OnAppearing();
}

protected override void OnDisappearing()
{
    base.OnDisappearing();
    this.SparkScanView.OnDisappearing();
}

To ensure the correct functioning of the SparkScanView, call sparkScanView.onPause() and sparkScanView.onResume() in your Fragment/Activity onPause and onResume callbacks:

protected override void OnPause()
{
    sparkScanView.OnPause();
    base.OnPause();
}

protected override void OnResume()
{
    sparkScanView.OnResume();
    base.OnResume();
}

5. Register the listener to be informed when a new barcode is scanned

To keep track of the scanned barcodes, implement the ISparkScanListener interface and register the listener to the SparkScan mode.

// Register self as a listener to monitor the SparkScan session.
sparkScan.addListener(this);

ISparkScanListener.OnBarcodeScanned() is called when a new barcode is scanned. This result is retrieved from the first object in the provided barcodes list: SparkScanSession.NewlyRecognizedBarcodes. Note that this list only contains one barcode entry.

public void OnBarcodeScanned(SparkScan sparkScan, SparkScanSession session, IFrameData? data)
{
    if (session.NewlyRecognizedBarcodes.Count == 0)
    {
        return;
    }

    // Gather the recognized barcode
    Barcode barcode = session.NewlyRecognizedBarcodes[0];

    // This method is invoked from a recognition internal thread.
    // Run the specified action in the UI thread to update the internal barcode list.
    RunOnUiThread(() =>
    {
        // Update the internal list and the UI with the barcode retrieved above
        this.latestBarcode = barcode;
    });
}

Alternatively, to register ISparkScanListener interface, it is possible to subscribe to corresponding events. For example:

sparkScan.BarcodeScanned += (object sender, SparkScanEventArgs args) =>
{
    if (args.Session.NewlyRecognizedBarcodes.Count == 0)
    {
        return;
    }

    // Gather the recognized barcode
    Barcode barcode = args.Session.NewlyRecognizedBarcodes[0];

    // This method is invoked from a recognition internal thread.
    // Run the specified action in the UI thread to update the internal barcode list.
    RunOnUiThread(() =>
    {
        // Update the internal list and the UI with the barcode retrieved above
        this.latestBarcode = barcode;
    });
}

6. Customize the scanning UI with advanced configurations

You can customize the SparkScan UI and UX using advanced configurations. This includes changing UI element colors (i.e. icons, buttons, toolbar), the trigger button icon, the size of the preview window, and more.

The graphic illustrates different examples of how to adjust colors, positions, and sizes to suit different UX scenarios.

How to test .NET barcode scanning performance

The best way to test your .NET barcode scanner API for iOS, Android, or MAUI is to run it using real user scenarios. Whether you’re using your own solution or SparkScan, here are several performance-testing questions to ask:

  • Is there clear user guidance and feedback to foster smooth workflows rather than confuse scanning tasks?
  • Can you scan barcodes with reflections and glare?
  • Can you scan barcodes at a distance? Are you able to zoom in if needed?
  • Can you scan barcodes in different orientations, such as upside down and sideways? Flip the device upside down to see how the scanner performs.
  • Do you receive scanning feedback in loud environments and while wearing headphones?

You can also use our barcodes sample sheet for quick evaluation of your .NET barcode reader API.

Your .NET Barcode Scanner SDK is more than just a technical choice

Brilliant UX and performance are key development goals to ensure your .NET barcode scanner API works in the real world. Fewer user frustrations and adaptability to growing business demands are far preferable to low adoption rates and bug reports.

Next: Dive deeper into how to make a barcode scanning app performant →