Quick Start
Xamarin End of Life Announcement
Anyline has been a longstanding provider of the Mobile SDK for Xamarin, catering to developers' needs for several years. As of autumn 2022, we have seamlessly transitioned our support to encompass the SDK for .NET (MAUI), recognized as the official successor to Xamarin. In alignment with Microsoft’s recommendation to migrate from Xamarin to .NET, and considering Microsoft’s cessation of support for Xamarin by May 2024, Anyline will discontinue the release of any additional updates, including new features or bug fixes, for Anyline Mobile SDK for Xamarin. Please find the Anyline Mobile SDK for .NET here. |
Follow this guide to set up a project for Xamarin.iOS in order to easily implement the Anyline SDK.
The Xamarin Bundle
The Xamarin SDK Bundle that you can download from GitHub contains the following parts for you to get started in Xamarin:
Requirements
To use the Anyline SDK for Xamarin.iOS you need:
-
An iOS device with minimum version 12
-
An iPhone 5s or newer
-
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 will require a Mac Build Host. |
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 on 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.
Build Host
If using Windows, make sure your macOS 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. |
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
, install the latest available version, and accept the license agreement.
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 |
Initialize the SDK
Initialize the Anyline SDK in your ViewController, or in another place your preference.
The Anyline SDK only needs to be initialized before its first usage, and only one time within the app’s lifecycle. |
public override void ViewDidLoad()
{
base.ViewDidLoad();
...
// INSERT YOUR LICENSE KEY HERE
string licenseKey = "YOUR_LICENSE_KEY";
// INITIALIZE THE ANYLINE SDK
bool validLicense = AnylineXamarinSDK.iOS.AnylineSDK.SetupWithLicenseKey(licenseKey, out NSError licenseError);
if (!validLicense)
{
var okAlertController = UIAlertController.Create("License Exception", licenseError.LocalizedDescription, UIAlertControllerStyle.Alert);
okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
PresentViewController(okAlertController, true, null);
System.Diagnostics.Debug.WriteLine(licenseError.LocalizedDescription);
}
}
In the next section, we will implement a ScanView and provide a configuration to customize visual parameters and behaviours.