Quick Start Guide

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

License API Migration to Anyline 26 and beyond

Starting with Anyline 26, we changed our point of initialization for the Anyline license in order to streamline our initialization process. Simply put the Anyline license check once globally in your application and then initialize any of the components (ScanView, ScanPlugins, etc.) without the license key parameter.

The Xamarin 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
  • Examples - Xamarin.iOS, Xamarin.Android and Xamarin.Forms example apps
  • com.anyline.xamarin.examples_<version>.apk - Prebuilt Android APK ready to install on your Android device

Requirements

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

  • Visual Studio 2017
  • An iOS device with minimum version 12 (from Anyline 27+)
  • An iPhone 5s minimum
  • An Apple developer account and your device set up for development.

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

Add the Anyline SDK via NuGet

To access the functionality of our SDK, simply right-click on your project, go to manage Nuget packages.. and search for “Anyline”.

Select “Anyline.Xamarin.SDK.iOS” and install the latest available version.

Accept the license agreement.

Extra steps for Xamarin.iOS

In order for Anyline to work correctly on Xamarin.iOS, you have to do one extra step so the Anyline resources get loaded correctly!

In your Visual Studio 2017, on the top bar, go to Tools -> NuGet Package Manager -> Package Manager Settings and change the package management format to Packages.config.

Change package management format

AnylineResource.bundle

Since Anyline 7, you don’t have to manually update and maintain the AnylineResource.bundle files in your project anymore. Our NuGet package will take care of that - this is why it’s very importan to change the package management format for your project. You can still find the AnylineResource.bundle files in the NuGet package folder, though.

Initialize the SDK

Initialize the Anyline SDK in your ViewController, or in another place your preference. The SDK only needs to be initialized once, before the first usage of the scan plugins.

public override void ViewDidLoad()
{
    base.ViewDidLoad();

    ...

    // INSERT YOUR LICENSE KEY HERE
    string licenseKey = "YOUR_LICENSE_KEY";

    // INITIALIZE THE ANYLINE SDK
    AnylineXamarinSDK.iOS.AnylineSDK.SetupWithLicenseKey(licenseKey, out NSError licenseError);

}

In the next section, we will implement a use-case with the Anyline ScanView to customize visual parameters and behaviours.