Getting Started

Quick Start Guide

This guide will lead you through the first steps of integrating the Anyline Tire Tread SDK into your Android app.

You can check out our GitHub respositories for Android and iOS for a full example implementation of the Anyline Tire Tread SDK.

The API documentation for the current version (11.2.0) is available here.

Add the Anyline Tire Tread SDK as dependency

  • Android

  • iOS

The Anyline Tire Tread SDK for Android is available through the maven registry: https://europe-maven.pkg.dev/anyline-ttr-sdk/maven.

To integrate it, add the Anyline Tire Tread SDK io.anyline.tiretread.sdk:shared as a dependency to your build.gradle, along with the compose compiler options.

repositories {
    // ... your other repositories ...
    mavenCentral()
    // Anyline Maven registry
    maven { url "https://europe-maven.pkg.dev/anyline-ttr-sdk/maven" }
}

android {
    namespace 'your.apps.namespace'
    compileSdk 34

    defaultConfig {
        minSdk 26
        targetSdk 34

        ...
    }
    buildFeatures {
        viewBinding true
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.4"
    }
}

dependencies {
    // Anyline Tire Tread SDK dependency
    implementation 'io.anyline.tiretread.sdk:shared:11.1.0'

    //... your other dependencies
}

The Anyline Tire Tread SDK for iOS is available via CocoaPods and Swift Package Manager.

=== CocoaPods

Add the following line to your Podfile:

pod 'AnylineTireTreadSdk'

Run pod install in the terminal in the same directory as your Podfile.

=== Swift Package Manager

In Xcode, go to File → Swift Packages → Add Package Dependency and enter the framework’s repository URL: https://github.com/Anyline/anyline-tiretread-spm-module


After adding the dependency, import the framework into your native iOS application with the following line:

import AnylineTireTreadSdk

The Anyline Tire Tread SDK follows the Semantic Versioning.

Integrate the Anyline License Key

A License Key string will be required in order to run the Anyline Tire Tread SDK on your app.

Store the License Key

You can integrate your license key string in a way that best suits your development workflow.

As the integrator, you are responsible for managing your license key securely within your application. We strongly recommend using platform-specific secure storage solutions such as the Keychain for iOS and the Keystore for Android. Alternatively, consider implementing Dynamic Delivery to retrieve the license key at runtime from a secure server. These approaches help ensure the protection of your license key and prevent unauthorized access.

Initialize the Tire Tread SDK with the License Key

Initialize the Anyline Tire Tread SDK - and handle any exceptions thrown - before doing anything related to the SDK.

  • Android

  • iOS

// This must be called before doing anything else with the AnylineTireTreadSdk.
// It only needs to be called once during your application life-cycle.

fun initializeAnylineTireTreadSdk() {
    // Replace `<your-license-key>` with your actual license key.
    val licenseKey = "<your-license-key>"

    // Try/Catch this to check if your license key is valid or not.
    try {
        AnylineTireTreadSdk.init(licenseKey, this)
        // continue the setup after successful initialization
    } catch (e: SdkLicenseKeyInvalidException) {
        // provided licenseKey is invalid
    } catch (e: SdkLicenseKeyForbiddenException) {
        // provided licenseKey not allowed
    } catch (e: NoConnectionException) {
        // no connection could be established
    } catch (e: Exception) {
        // SDK initialization failed for any unexpected reason
    }
}
// This must be called before doing anything else with the AnylineTireTreadSdk.
// It only needs to be called once during your application life-cycle.
func tryInitializeSdk(context: UIViewController) {
    do {
        // Replace `<your-license-key>` with your actual license key.
        let licenseKey = "<your-license-key>"

        try AnylineTireTreadSdk.shared.doInit(licenseKey: licenseKey)
        // continue the setup after successful initialization
    } catch {
        // To get the error object from the TireTread SDK, you first need to convert it to KotlinException
        if let kException = (error as NSError).kotlinException {
            switch kException {
            case let ex as SdkLicenseKeyInvalidException:
                // provided licenseKey is invalid
            case let ex as SdkLicenseKeyForbiddenException:
                // provided licenseKey not allowed
            case let ex as NoConnectionException:
                // no connection could be established
            default:
                // SDK initialization failed for any unexpected reason
            }
        }
    }
}

This function attempts to initialize AnylineTireTreadSdk with the provided license key. If the SDK fails to initialize, you should handle this error appropriately.

Request the necessary permissions and features

Before starting the scan process, it is crucial to check and request some permission, as they are required for the SDK to function correctly.

The Anyline Tire Tread SDK uses the camera for scanning the tires - your application must request the user’s permission to access the camera before using the TireTreadScanView.

  • Android

  • iOS

The Internet access permission is required at all times, whenever the SDK is called. To use the Haptic feedback, the Vibration permission should also be requested during compile time.

Here is the full list of permissions and features required by the Tire Tread SDK for Android:

  • Permissions

    • CAMERA

    • INTERNET

    • VIBRATE

  • Features

    • android.hardware.camera

    • android.hardware.camera.flash

    • android.hardware.camera.autofocus

Here is an example on how you can add them to your AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <!-- declare camera, internet, and vibrate permission -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-feature android:name="android.hardware.camera" android:required="true" />
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="true" />
    <uses-feature android:name="android.hardware.camera.flash" android:required="false" />

    ...
</manifest>

Please refer to the Official Android Documentation for more information about requesting runtime permissions, and/or check our example implementation on GitHub.

Please refer to the Official iOS Documentation for more information about requesting camera access authorization, and/or check our example implementation on GitHub.

In the next section, you will learn how to integrate the TireTreadScanView to start scanning and measuring tires with your application.

Refer to the platform specific documentation for Android or iOS.