Tire Sidewall Scanner

The Tire Sidewall Scanner is a feature that reads the information off the tire sidewall. 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 way to take the picture manually - the guidance does this for you. We then extract the information from the photo and return the results as structured JSON, together with the captured image.

You launch it, the user scans, and you receive a single TswScanResult in your callback.

What you need

  • A client ID - a string, provided by Anyline, that authenticates the Tire Sidewall scan. It is separate from your TTR SDK license key.

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

  • A ≥ 12 MP camera with good ISP processing.

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 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 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_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_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 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.

For the structure and fields of resultJson, see the Data extraction reference section below.

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 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):

Data extraction reference

The resultJson in a Completed result contains the tire sidewall information extracted from the captured image. A reading currently includes the following fields:

Example Tire Sidewall
  • Tire Identification Number (DOT/TIN)

  • Tire Size

  • Tire Make

  • Tire Model

  • Tire Model Group

  • Tire Details

 
 
 
 

Tire Identification Number (DOT)

Example Tire Identification Number

The DOT is located once on the tire sidewall, and is an alphanumeric text usually of length 6 to 17 characters. TINs can start with "DOT", which in that case means that they are certified by the U.S. Department of Transportation and legal to be driven in the U.S. Usually, properties like manufacturer and plant code, tire size code, and the week and year the tire was produced, are encoded in the TIN.

TINs starting with "DOT" are returned as the extracted text as is, with the production date returned separately.

Examples

DOT K540 JFFR 4019
DOT HW8K P3X0 0517
DOT 6YAL D8LV 2119
DOT XJ 9T W390 5120
DOT 6GAD DCYY 0519

For a TIN without "DOT", the production date is still returned in three separate formats:

"productionDateWeekYear": "3320",
"productionDateYearMonth": "2020/08",
"tireAgeInYearsRoundedDown": 5

Tire Size

Example Tire Size

The Tire Size provides information about certain properties of the tire.

 
 
 
 

Extracted Information

The following fields are extracted and put together into the output text:

Type Description Example

width (W)

Width of tire in millimeters

105, 155, 215

ratio (R)

Tire aspect ratio

50, 60, 65

construction (C)

Construction of the fabric carcass

R, B, D, (EMPTY)

diameter (D)

Rim diameter in inches

13, 15, 17

speed rating (S)

A letter code indicating the maximum speed a tire can safely sustain.

Speed rating table

load index

A numerical code on a tire’s sidewall that signifies the maximum weight it can safely carry when properly inflated

Load index table

{
  "details": {
    "loadIndex": "92",
    "speedRating": "H"
  },
  "size": "205/60R16"
}

Supported formats

The following formats are currently supported:

Type Format Example

Standard passenger

[P|HL]###/##R## ###[/###][SS]

P255/65R15 120Y

Passenger ZR

[P|HL]###/##ZR##[ ###(V|W|Y|(Y))][ XL][ RF]

P255/65ZR15 120Y XL

Passenger RF

[P|HL]###/## RF## ###[/###][SS]

245/45RF14 121/120R

Passenger ZRF

[P|HL]###/## ZRF##[ ###(V|W|Y|(Y))][ XL][ RF]

245/45ZRF14 91V XL

Metric C

###/##R##C ###[/###]S

225/75R16C 121/120R

Light Truck

LT###/##R## ###[/###]S

LT245/75R16 120/116S

Flotation, Jeeps, Off-road-built SUVs, Pickup trucks

##[.#]x##[.##]R##LT ###S

35x12.50 R15LT, 37x12.50 R17LT, 35x12.50 R17LT, 33x12.50R17LT

Light Truck with dual load and speed ratings

LT###/## R## ###S/###S

LT245/75 R16 120S/116S

Commercial / medium-duty truck tires

###/## R##.5 ###[/###][G|J|K|L|M]

245/70 R19.5 136/134J, 225/75 R17.5 129/127G

Truck inch width

#[#.##] R## ###[/###][G|J|K|L|M]

12.00 R20 154/149K, 12.00 R20 154/149J, 12.00 R20 149/146J

Tire Make

Example Tire Make

The Tire Make is the brand/manufacturer of the tire and is
returned as is.

 

Output Format

The output of the Tire Make is in upper case format.

GOOD YEAR
CONTINENTAL
FIRESTONE
MICHELIN
GOODRIDE

Tire Model

Example Tire Model

The Tire Model is returned as is.

Output Format

The output of the Tire Model is in upper case format.

SNOWTRAC 3
WINTERHAWK 3
ECOCONTACT 6
ALPIN 5

Tire Model Group

Example Tire Model Group

The Tire Model Group is a subset of the full tire model name (e.g. "SNOWTRAC" for "SNOWTRAC 3") and is returned if a tire model group exists for a given tire model.

Output Format

The output of the Tire Model Group is in upper case format.

SNOWTRAC
WINTERHAWK
ECOCONTACT
ALPIN

Tire Details

The Tire Details return additional information extracted from the tire sidewall.

Currently, the following information is returned:

Field Type Description

productionDateWeekYear

String

The production date as it is found on the tire. The first two digits indicate the calendar week and the last two digits the year.

productionDateYearMonth

String

The production date converted into the format: YYYY/MM.

tireAgeInYearsRoundedDown

Integer

The number of years between the production date and now, rounded down.

loadIndex

String

The load index as extracted from the tire size.

speedRating

String

The speed rating as extracted from the tire size.

"productionDateWeekYear": "2418",
"productionDateYearMonth": "2018/06",
"tireAgeInYearsRoundedDown": 6,
"loadIndex": "92",
"speedRating": "H"