Getting Started

Requirements

In order to be able to use the Anyline SDK, only two requirements have to be met:

  • An Android device with Android SDK Level >= 19
  • An Android device with decent camera functionality (recommended: 720p and adequate auto focus)

The Anyline SDK Examples Bundle

If you rather like to jump into some code than to walk through a Quick Start Guide, a good starting point for development with the Anyline SDK, is to download the Android SDK Bundle.

It includes the following:

  • The Anyline SDK in version 6 for offline integration
  • A build version of the Anyline OCR Examples App
  • The source code of the Anyline OCR Examples App
  • The Javadoc for the Anyline SDK
  • This documentation
  • The third party licenses
  • A Readme
  • The current Release Notes

Not included in the bundle are the Example Sheets with testing material.
They can be downloaded here: Example Sheets

Quick Start Guide

This guide is going to lead you through the first steps when implementing the Anyline SDK on Android.

Add AnylineSDK as dependency

The Anyline SDK for Android is provided as an .aar library. You can integrate it into your app in two ways.

From maven

You can simply add the Anyline SDK as a dependency in your build.gradle. This way you can easily change versions, without having to download the new SDK version yourself.

Add the Anyline SDK via maven
//root section of the file
repositories {
    //add the anyline maven repo
    maven { url 'https://anylinesdk.blob.core.windows.net/maven/'}
}

dependencies {
    //add the anyline sdk as dependency (maybe adapt version name)
    compile 'io.anyline:anylinesdk:[email protected]'
    //... your other dependencies
}

Locally

If you rather add the Anyline SDK locally as a lib, you can do so as well. To do so, you have to copy the .aar file to the libs directory of your Android project. This is usually located under app/libs.

You can download an offline version of the Anyline SDK from the Android SDK Bundle

Add the Anyline SDK as a local library
//root section of the file
repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile(name:'anylinesdk-3.17.0', ext:'aar')
    //... your other dependencies
}

Generate an Anyline License

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 applicationId of your Android app.

License <> ApplicationId

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

How to identify the Application ID

In your build.gradle file

On Android, the applicationId can be found in the build.gradle file of your app.

It is listed there under android > defaultConfig > applicationId

In your AndroidManifest.xml

If the applicationId is not used in the build.gradle file, you may use the package name of your application that is defined in the AndroidManifest.xml

Generate the License

With the applicationId you are now able to Generate a License

Integrate the License Key

Add the License Key as a Resource

You can add your License Key to a string resource file, or put it hard-coded into your Java file. However, we recommend to add a seperate resource file (e.g. anyline_license_key.xml) to your res/values folder.

This should look like the following:

anyline_license_key.xml
<resources>
        <string name="anyline_license_key" translatable="false">YOUR_LICENSE_KEY</string>
</resources>

Load the License Key in your Activity

In the Activity, where you initialise the Anyline SDK, you can access the License Key Resource the following way:

Load the License Key Resource
String licenseKey = getString(R.string.anyline_license_key);

Load a Plugin and start scanning

Now you are all set to load one of the Anyline SDK Plugins and start scanning.

The Plugins on Android are described in detail at Plugins in the next section.