Tire Sidewall Scanner

The Tire Sidewall Scanner is a convenience feature that handles a tire-sidewall reading end to end, so you don’t have to integrate the Anyline Cloud API yourself. It presents a guided, full-screen camera experience that walks the user through aligning the tire and captures the sidewall automatically once it is correctly framed - there is no manual shutter to wire up. It then uploads the photo to the Anyline Cloud API on your behalf and returns the structured reading together with the captured image.

You launch it, the user scans, and you receive a single TswScanResult in your callback - no Cloud API request to build, and no capture logic to manage.

What you need

  • A Cloud API client ID - a string that authenticates the upload to the Anyline Cloud API. This is separate from your SDK license key; it is provided by Anyline.

  • Camera permission. The scanner requests it at runtime. On iOS, add an NSCameraUsageDescription entry to your Info.plist (see Getting Started).

Check device support

Before launching, you can confirm the device can run the scanner. isSupported() returns a TswSupportStatus and does not require the SDK to be initialized.

  • TswSupportStatus.Supported - the device can run the scanner.

  • TswSupportStatus.Unavailable - carries an error (SdkError) and a userResolvable flag. On Android, when userResolvable is true (e.g. Google Play Services needs an update), call AnylineTireSidewallScanner.resolvePlayServices(activity) to show the system resolution dialog.

  • Android

  • iOS

import io.anyline.tiretread.sdk.api.AnylineTireSidewallScanner
import io.anyline.tiretread.sdk.api.TswSupportStatus

// isSupported() is a suspend function - call it from a coroutine.
when (val status = AnylineTireSidewallScanner.isSupported()) {
    is TswSupportStatus.Supported -> {
        // Ready to scan
    }
    is TswSupportStatus.Unavailable -> {
        // status.error: SdkError describing why
        if (status.userResolvable) {
            AnylineTireSidewallScanner.resolvePlayServices(activity)
        }
    }
}

On iOS the scanner is supported on every device that meets the framework’s minimum iOS version, so isSupported() always reports Supported. You can proceed directly to launching a scan.

Launch a scan

Call scan(…​) with the host, your Cloud API client ID, and an optional TswScannerConfig. The result is delivered once to the onResult callback.

Input Description

from

The host that presents the scanner - an Android Context (Activity context) or an iOS UIViewController.

clientId

Your Anyline Cloud API client ID.

config

Optional TswScannerConfig. Omit it to use the defaults.

onResult

Callback invoked exactly once with a TswScanResult.

  • Android

  • iOS

import io.anyline.tiretread.sdk.api.AnylineTireSidewallScanner
import io.anyline.tiretread.sdk.api.TswScanResult

AnylineTireSidewallScanner().scan(
    from = context,
    clientId = "<YOUR_CLOUD_API_CLIENT_ID>",
) { result ->
    when (result) {
        is TswScanResult.Completed -> { /* see "The result" below */ }
        is TswScanResult.Failed    -> { /* result.error: SdkError */ }
        TswScanResult.Aborted      -> { /* user cancelled before capture */ }
    }
}
import AnylineTireTreadSdk

AnylineTireSidewallScanner().scan(
    from: self,
    clientId: "<YOUR_CLOUD_API_CLIENT_ID>"
) { result in
    if let completed = result as? TswScanResult.Completed {
        // see "The result" below
    } else if result is TswScanResult.Aborted {
        // user cancelled before capture
    } else if let failed = result as? TswScanResult.Failed {
        // failed.error: SdkError
    }
}

onResult is always invoked on the main thread, for every outcome - so you can update your UI directly from it.

The result

TswScanResult is one of three outcomes:

Outcome Meaning

Completed

Capture and upload both succeeded. Carries the fields below.

Failed

The scan could not be completed. Carries an error of type SdkError (code, type, message).

Aborted

The user dismissed the scanner before a capture was taken.

Completed exposes:

Field Type Description

resultJson

String

The raw JSON response from the Anyline Cloud API containing the sidewall reading (e.g. the tire size). Parse it with your JSON library of choice.

imageBytes

ByteArray

The captured sidewall image, upright and ready to display or store. On iOS this is a KotlinByteArray; convert it with .toNSData().

scanMetadata

TswScanMetadata

Capture metadata. Currently exposes environmentLighting.

resultJson contains the tire sidewall reading extracted from the image - the tire size, the Tire Identification Number (DOT/TIN), the make, model and model group, and additional tire details.

TswScanMetadata.environmentLighting is an EnvironmentLighting? describing the ambient lighting at capture - Dark, Bright, or Good - or null if no reading was available.

  • Android

  • iOS

is TswScanResult.Completed -> {
    val json = result.resultJson                          // reading (JSON)
    val image = result.imageBytes                         // captured image
    val lighting = result.scanMetadata.environmentLighting // Dark / Bright / Good / null
}
if let completed = result as? TswScanResult.Completed {
    let json = completed.resultJson                          // reading (JSON)
    let image = completed.imageBytes.toNSData()              // captured image
    let lighting = completed.scanMetadata.environmentLighting // Dark / Bright / Good / nil
}

Configuration

TswScannerConfig is optional. Construct it, override only what you need, and pass it to scan(…​).

Field Type Description

correlationId

String?

Optional ID to correlate this scan with other Anyline scans (e.g. a matching Tire Tread scan). Must be a version-4 UUID when set; an invalid value fails the scan with INVALID_UUID.

texts

TswScannerTexts

Overridable UI strings shown on the scanner overlay. Set individual entries (texts.textAlignTire, texts.textHoldSteady, …) to localize the on-screen guidance; any string you don’t set keeps its English default. For the complete list of overridable strings and their defaults, see the TswScannerTexts API reference.

  • Android

  • iOS

import io.anyline.tiretread.sdk.tsw.ui.configs.TswScannerConfig

val config = TswScannerConfig().apply {
    correlationId = workflowUuid                              // optional, v4 UUID
    texts.textAlignTire = getString(R.string.tsw_align_tire)  // optional localization
}

AnylineTireSidewallScanner().scan(from = context, clientId = clientId, config = config) { result ->
    // ...
}
let config = TswScannerConfig()
config.correlationId = workflowUuid                                       // optional, v4 UUID
config.texts.textAlignTire = NSLocalizedString("tsw_align_tire", comment: "") // optional localization

AnylineTireSidewallScanner().scan(from: self, clientId: clientId, config: config) { result in
    // ...
}

Errors

A Failed result carries an SdkError. The codes a sidewall scan can surface include:

Code When

INVALID_LICENSE

The Cloud API client ID is missing, invalid, or not authorized.

CAMERA_PERMISSION_DENIED

Camera permission was not granted.

NO_CONNECTION / TIMEOUT

The device is offline or the upload timed out.

UPLOAD_FAILED

The image could not be processed by the backend.

INVALID_UUID

The supplied correlationId is not a valid version-4 UUID.

ALREADY_RUNNING

A sidewall scan is already in progress.

See Errors for the full SdkError structure.

API reference

Generated reference documentation for the public types on this page (each opens in a new tab):