Scan Process - Overview
AnylineTireTreadScanner
The scanning process is performed entirely through the AnylineTireTreadScanner, and can only be conducted in Landscape mode.
|
The SDK automatically prevents portrait scans, so you don’t have to worry about managing device orientation. |
|
This SDK requires devices with advanced camera capabilities that provide depth/distance information such as lens focus distance. Not all devices support this feature. We recommend testing on your target devices to verify compatibility. |
The scanner launches the SDK UI full-screen and automatically handles camera access, permission requests, and scan guidance (via the Default UI), so you can simply handle the returned ScanOutcome to integrate it into your app’s workflow.
The scanner can be started directly from your screen without any additional setup beyond SDK initialization.
-
Android
-
iOS
val scanner = AnylineTireTreadScanner()
val config = TireTreadConfig()
scanner.scan(from = activity, config = config) { outcome ->
when (outcome) {
is CompletedOutcome -> openResultScreen(outcome.measurementUUID)
is AbortedOutcome -> finish()
is FailedOutcome -> showError(outcome.error)
}
}
let scanner = AnylineTireTreadScanner()
let config = TireTreadConfig()
scanner.scan(from: self, config: config) { outcome in
if let completed = outcome as? CompletedOutcome {
self.openResultScreen(uuid: completed.measurementUUID)
} else if outcome is AbortedOutcome {
self.dismiss(animated: true)
} else if let failed = outcome as? FailedOutcome {
self.showError(failed.error)
}
}
Scan Outcomes
The scanner completion callback returns a ScanOutcome instead of separate success and error callbacks.
| Kind | Meaning | Fields |
|---|---|---|
|
Frames were captured and uploaded successfully. |
|
|
The user closed the scanner before the scan flow completed. |
|
|
The scan could not complete. |
|
In code, you will usually branch on the concrete outcome type: CompletedOutcome, AbortedOutcome, and FailedOutcome.
TireTreadConfig
The scanner can be used directly without any additional configuration.
To modify the behavior, appearance, or metadata of the scan process, you can use the TireTreadConfig object.
The TireTreadConfig provides, out of the box, everything needed for a successful scan, so you only need to change the specific properties that you want to modify!
For a full list of properties, their description and default values, check the Scan Configuration page.
ScanOptions
scan() accepts an optional ScanOptions parameter for runtime behavior that is separate from the scan configuration.
| Field | Default | Description |
|---|---|---|
|
|
When |
-
Android
-
iOS
import io.anyline.tiretread.sdk.api.options.ScanOptions
scanner.scan(
from = activity,
config = config,
options = ScanOptions(enableDebugLogging = true),
) { outcome ->
// handle outcome
}
scanner.scan(
from: self,
config: config,
options: ScanOptions(enableDebugLogging: true)
) { outcome in
// handle outcome
}
Tire Width
To increase the accuracy of scans and compatibility with the broad range of Android device models on the market, the scan process on Android will automatically request the user to provide the width of the tire being scanned (see TireWidthInput).
If this information is already available in your system (for example, from scanning with the
Anyline Tire Sidewall Scanners), you can provide it directly to the tireWidth parameter of the TireTreadConfig, thus skipping the TireWidthInput screen step on Android.
For example:
If your system contains a string formatted like "255/65R17", the three-digit number preceding the "/" represents the tire width (in this case, 255). If the tire width is embedded within a full string, you can extract it using string manipulation techniques such as regular expressions or the split function.
After extracting the number, verify that it is an integer between 100 and 500. If it meets this requirement, pass it to the Tire Tread SDK using the config parameter (scanConfig.tireWidth). If the number does not fall within this range, it is not a valid tire width. In this case, you can ignore the parameter (thus sending null to it), prompting the TireWidthInput screen to automatically appear for the user.
fun extractTireWidthFromTireSizeString(tireSizeString: String): Int? {
val regex = Regex("""[A-Za-z]*\d{3}""")
val match = regex.find(tireSizeString)
val tireWidth = match?.value?.filter { it.isDigit() }?.take(3)?.toIntOrNull()
return if (tireWidth in 100..500) {
tireWidth
} else {
null
}
}
/* usage: */
val extractedTireWidth = extractTireWidthFromTireSizeString(tireSizeString) // e.g. "P255/65R17"
println(extractedTireWidth) // Output: 255
val config = TireTreadConfig().apply {
scanConfig.tireWidth = extractedTireWidth
}
On iOS, the tire width is not necessary, and the input screen will not be displayed.
Audio Feedback
The Tire Tread SDK can provide audio feedback to guide users to position the device correctly through the scan process.
To make use of these audio feedbacks, your application needs to provide (and thus can customize) the audio files inside its Assets (Android) or Resources (iOS) folder.
The audio feedbacks (with their respective files names) are played on:
-
Focus Point Found (iOS only)
-
tiretread_focuspoint_found.wav
-
-
Scan Started
-
tiretread_sound_start.wav
-
-
Scan Stopped
-
tiretread_sound_stop.wav
-
-
Phone too close to the Tire
-
tiretread_sound_beep_too_close.wav
-
-
Phone too distant from the Tire
-
tiretread_sound_beep_too_far.wav
-
The SDK only supports these file names, and the .wav extension.
An example implementation, and the example audio files, can be found in our Android and iOS GitHub example implementations.
|
To disable the audio feedback completely, remove these audio files from your application’s resources or rename them. |
Scan Guide
Before starting, check out the quick How to Measure Tire Tread guide to learn how to perform the perfect scan!
Once you are able to perform the scans, head to the next section page to learn how to handle the measurement results.