Xamarin SDK

Overview

The Datalogic Xamarin SDK allows developers to write Android apps using the C# language to access features available on Datalogic Android devices. The Datalogic 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

Xamarin development requires either using Visual Studio on Windows or MacOS. Visual Studio 2019 is recommended. If you don't yet have Visual Studio installed with Xamarin support, follow Microsoft's guide for Visual Studio 2019 on Windows here.

Create a Xamarin Project

Open Visual Studio and select New Project...

New Project

In the New Project window, navigate to Installed > Templates > Visual C# > Cross-Platform. Select Blank App (Android)(or another of the Blank App types, depending on your use case).

New Project > Android

If you get a Xamarin Mac Agent prompt, click Close. Your new project should now be created. In Solution Explorer, find and open MainActivity.cs. Your window should now look similar to this:

MainActivity

tip

If you would rather just start with an example Xamarin project that is already configured to use the Datalogic Xamarin SDK, check out the DecodeListener sample project.

NuGet

NuGet is a widely used package manager for .NET development that comes preinstalled in Visual Studio. Datalogic uses NuGet to distribute the Datalogic Xamarin SDK. First, open NuGet by navigating to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

NuGet Open

In the 'NuGet - Solution' tab, Click Browse. Type datalogic in the search box. Select the result titled datalogic-xamarin-sdk.

NuGet Browse

Next, select the MyXamarinApp.Droid Project and click Install.

NuGet Install

Click Installed at the top of the window. You will now see 'datalogic-xamarin-sdk' listed as an installed package.

NuGet Installed

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 the MyXamarinApp.Droid Project. Add this line in your code:

BarcodeManager decoder = null;

You should see that Intellisense is working for the Datalogic 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.

You can use the Object Browser to list the available constants, classes, interfaces and methods, along with documentation for each. To open the Object browser, double click on datalogic-xamarin-sdk under MyXamarinApp.Droid > References in the Solution Explorer window. Now, in the Object Browser window, expand the datalogic-xamarin-sdk Assembly and find the item you are interested in researching.

A

Compile and Run

Connect your Datalogic mobile computer running Android to your computer via USB cable and click the Run button.

A

Congratulations, you are all set up! Head over to the Samples apps to learn how to use various parts of the Datalogic Xamarin SDK.