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

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
}
groovy

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.

// 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
    }
}
kotlin

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.

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>
xml

Please refer to the Official Android Documentation for more information about requesting runtime permissions, 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.