Quick Start Guide

Follow this guide to set up a project for Xamarin.iOS in order to easily implement the Anyline SDK.

The Xamarin.iOS Bundle

The Xamarin SDK Bundle that you can download from github contains the following parts for you to get started in Xamarin:

  • BindingSource - Xamarin iOS and Android Binding Libraries, including wrappers
  • Examples - Xamarin.iOS and Xamarin.Android example apps
  • AnylineXamarinSDK.Droid.dll - Precompiled library for Xamarin.Android
  • AnylineXamarinSDK.iOS.dll - Precompiled library for Xamarin.iOS
  • AnylineResources.Bundle - The iOS Resource files that have to be included to your app project as BundleResource (iOS only!)
  • AT.Anyline.Xamarin.App.Droid_<version>.apk - Prebuilt Android APK ready to install on your Android device
  • README.md - A short readme about the Anyline Xamarin Examples bundle.
  • LICENSE.md - The license file.

Requirements

To use the Anyline SDK for Xamarin.iOS you need:

  • A Xamarin account (If you work with Visual Studio, you need at least a Xamarin business account. Check out the Xamarin Website for detailed information)
  • An iOS device with minimum version 10
  • An iPhone 5 minimum
  • An Apple developer account and your device set up for development.
  • Xamarin Studio or Visual Studio as an IDE

Apple Developer Account

In order to set up an Apple Developer Account and the device, please follow the Device Provisioning Guide from the Xamarin Documentation

Developing on a Windows Machine

If you want to develop on a Windows machine, you require a Mac Build Host. For more information, please check out the Windows Installation Guide from the Xamarin Documentation on how to install Xamarin.iOS on Windows

Setup

In this section we will go through the basic process of creating and configuring a simple Anyline scanning application in Xamarin.iOS. If you are not yet familiar with Xamarin.iOS, follow the Official Xamarin iOS Getting Started Guide to develop an understanding of the fundamentals of iOS application development with Xamarin.

Create a new Xamarin.iOS Project

If you are using Visual Studio, click File > New Project…, select Visual C# > iOS > iPhone and create a new Single View App for iPhone.

Create a Xamarin iOS

Build Host

Make sure your build host is up and running and pair Visual Studio with the build host. If you have any troubles with this step, please refer to the Troubleshooting Guide on the Xamarin Documentation

Generate an Anyline License Key

In order to run the Anyline SDK in your app, you require a license key.

In order to create a license key for your application, you have to identify the bundle identifier of your Xamarin.iOS app.

License <> Bundle Identifier

Every license is bound to an bundle identifier. If you change your bundle identifier, you will require a new license. This also ensures that your license key cannot be used in any other application.

How to identify the Bundle Identifier

To generate a license key for your application, refer to the bundle identifier of your Xamarin.iOS project. It is located under Properties > iOS Application > Identifier.

Identify the Bundle Identifier

Generate the License

With the bundle identifier you are now able to Generate a License

Once you generated your license key for the bundle identifier of your app, you can integrate it as follows:

Integrate the License Key

In order to integrate your generated license key, simply add it as a string within your scanning ViewController class.

// in your scanning ViewController class:

public const string LicenseKey = "INSERT_YOUR_LICENSE_KEY_HERE";

// in the ViewDidLoad() cycle:

// Initialize with our license key and our result listener
bool success = scanView.SetupWithLicenseKey(LicenseKey, Self, out _error);

Add the Anyline SDK

In the Project View, right-click on the References node, select Add Reference… and locate the AnylineXamarinSDK.iOS.dll.

When added, the SDK should be visible in the solution explorer and look like this:

The Anyline SDK in the Xamarin project tree

Add AnylineResources.bundle

Simply drag and drop the AnylineResources.bundle folder into the Resources node of your project.

The project structure should now look like this:

The Anyline Resource Bundle in the Xamarin project tree

Updating AnylineResources.bundle files

If you’re already using Anyline Xamarin.iOS in your application and you want to integrate a newer Anyline version in your project, it’s important that you also update the AnylineResources.bundle in your Resources folder of the project. To make sure that the application compiles using the updated AnylineResources.bundle files, delete the /bin and /obj folder of the project, and also remove everything on your Mac in the folder /Users/<My Username>/Library/Caches/Xamarin/mtbs/builds/. It might also be necessary to uninstall the iOS app from your device before rebuilding it.

In the next section, we will implement a Scan View and provide a configuration to customize both visual parameters and behaviours.