Android SDK - Getting Started

You can check out our GitHub repository for example code.

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 repository for example code.

Add Anyline Tire Tread SDK as dependency

The Anyline Tire Tread SDK for Android is available through the maven registry: artifactregistry://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 activity-compose dependency.

It is also necessary to include the Google Cloud Artifact Registry plugin, at the beginning for your file, e.g.:

plugins{
    // ... your other plugins ...
    id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.0"
}

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

dependencies {
    // ... your other dependencies ...

    // Anyline Tire Tread SDK dependency
    // ideally, you should pin (at least) the Major version of the SDK to avoid unexpected breaking changes
    implementation 'io.anyline.tiretread.sdk:shared:2.+'

    // Include the 'Compose' dependency to be able to
    // integrate the TireTreadScanView in your Pages
    implementation 'androidx.activity:activity-compose:1.7.0'

    //... your other dependencies
}

The Anyline Tire Tread SDK follows the Semantic Versioning.

Anyline License Key

In order to run the Anyline Tire Tread SDK in your app, a License Key will be required.

Integrate the License Key

You can integrate your License Key however best fits your application’s workflow.

You can add it to a strings.xml resource file; have it hard-coded into your Java/Kotlin file (not recommended, in most cases); securely fetch it from your back-end server or secret manager/provider; or request your appplication’s user to manually enter their License Key.

Initialize the Android Tire Tread SDK with the License Key

Initialize the Anyline Tire Tread SDK - and handle the exceptions - before doing anything related to the SDK. Here is an example on how to do it in Kotlin:

// This must be called before doing anything else with the AnylineTireTreadSdk.
// It only needs to be called once during your application life-cycle.
private fun initializeAnylineTireTreadSdk() : Boolean {

    // Try/Catch this to check if your license key is valid or not.
    try {
        AnylineTireTreadSdk.init(licenseKey, this)
        Log.i("Init SDK", "Success")
        return true
    } catch (e: SdkLicenseKeyInvalidException){
        Log.e("SettingsActivity", e.message, e)
        Toast.makeText(this,
            getString(R.string.txt_error_setup_failure_license_key),
            Toast.LENGTH_LONG).show()
    } catch (e: SdkInitializeFailedException){
        Log.e("SettingsActivity", e.message, e)
        Toast.makeText(this,
            getString(R.string.txt_error_setup_failure),
            Toast.LENGTH_LONG).show()
    }
    return false
}

Add the necessary permissions and features

The TireTreadScanView requires the following permissions and features on your application:

  • 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>
The "VIBRATE" permission is only required if you use the Vibration feedback on your application. This can be implemented by your application, or activated in the ScanView via the "useDefaultHaptic" option.
The Anyline Tire Tread SDK uses the camera for scanning the tires - your application must request the users' permission to access the camera before using the TireTreadScanView. Please refer to the Official Android Documentation for more information about requesting runtime permissions.

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