MAUI / Xamarin SDK
Overview
The Datalogic MAUI / Xamarin SDK allows developers to write Android apps using the C#
language to access features available on Datalogic Android devices. This can be done using either the .NET MAUI framework or the Xamarin platform, both available through Visual Studio. The Datalogic MAUI / Xamarin SDK is distributed as 2 separate APIs, the standard API, and the self-shopping API.
Standard API
Provides essential APIs related to the device scanner and device itself.
Self-shopping API
Provides APIs related to the locking cradle available for use with Joya Touch Android
and Memor 1
devices.
Using the SDK
Install Visual Studio
MAUI development requires Visual Studio 2022. If you don't yet have Visual Studio installed with MAUI support, you can follow the Microsoft MAUI installation guide here. Xamarin development requires either using Visual Studio on Windows or MacOS. Visual Studio 2022 is recommended. If you don't yet have Visual Studio installed with Xamarin support, follow Microsoft's Installing Xamarin guide here.
Create a MAUI Project
Open Visual Studio and select Create a new project
In the New Project window, type MAUI into the search bar at the top, and select .NET MAUI App. Click through and select .NET 6.0.
Your new project should now be created. In Solution Explorer, navigate to Platforms/Android/MainActivity.cs. Your window should now look similar to this:
Skip down to the NuGet section to learn how to install the Datalogic SDK.
Create a Xamarin Project
Open Visual Studio and select Create a new project
In the New Project window, type android into the search bar at the top, and select Android App (Xamarin). Click through and select Blank App.
Your new project should now be created. In Solution Explorer, find and open MainActivity.cs. Your window should now look similar to this:
If you would rather just start with an example Xamarin project that is already configured to use the Datalogic MAUI / Xamarin SDK, check out the DecodeListener sample project.
NuGet
NuGet is a widely used package manager for .NET development that comes pre-installed in Visual Studio. Datalogic uses NuGet to distribute the Datalogic MAUI / Xamarin SDK. The installation is the same for both MAUI and Xamarin solutions. First, open NuGet by navigating to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
In the 'NuGet - Solution' tab, Click Browse. Type datalogic in the search box. Select the result titled datalogic-xamarin-sdk. Next, select your project and click Install.
Click Installed at the top of the window. You will now see 'datalogic-xamarin-sdk' listed as an installed package.
You can now close the NuGet tab.
Use the SDK
You can now start using the SDK in your code. For example, open MainActivity.cs inside your project. Add this line in your code:
BarcodeManager decoder = null;
You should see that Intellisense is working for the Datalogic MAUI / Xamarin SDK as you type. At this point, you could go over to the DecodeListener sample project to understand what is necessary to receive barcode data in your application.
Compile and Run
Connect your Datalogic mobile computer running Android to your computer via USB cable and click the Run button.
Congratulations, you are all set up! Head over to the Samples apps to learn how to use various parts of the Datalogic MAUI / Xamarin SDK.