Scan Process - Overview
The API documentation for the current version (12.1.0) is available here. |
TireTreadScanView
The scanning process is performed entirely through the TireTreadScanView , and can only be conducted in Landscape mode.
The |
The TireTreadScanView
is a UI element that can be added as a subview to your page.
This element automatically handles camera access, permission request, and scan guidance (via the Default UI), so you can simply listen to the callbacks to seamlessly integrate it into your app’s workflow.
-
Android
-
Swift
TireTreadScanView(
onScanAborted = onScanAborted,
onScanProcessCompleted = showResult,
callback = null,
onError = { measurementUUID, exception ->
/* Handle initialization error */
})
TireTreadScanViewKt.TireTreadScanView(
context: self,
onScanAborted: onScanAborted,
onScanProcessCompleted: showResult,
callback: nil
) { measurementUUID, error in
// Handle initialization error
}
Tire Width
To increase the accuracy of scans and compatibility with the broad range of Android device models on the market, the TireTreadScanView
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(e.g., from scanning with the
Anyline Tire Sidewall Scanners) you can provide it directly to the tireWidth
parameter of the
TireTreadScanView, thus skipping the TireWidthInput
screen step.
For example:
If you have in your system a string like "255/65R17", the 3-digit number before the “/” is the tire width (255). If the tire width is only available as full string, use string manipulation to get the tire width out of the string (e.g. regex, split).
Once extracted, check if the number is an integer between 100 and 500, if that’s the case, hand it over to the Tire Tread SDK via the tireWidth
parameter. If that’s not the case, it’s not a valid tire width, so you can ignore the parameter (or send null
to it), and the TireWidthInput
screen will automatically show up to 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
// provide the extractedTireWidth directly to the "tireWidth" parameter of the TireTreadScanView
TireTreadScanView(
config = myScanViewConfig,
tireWidth = extractedTireWidth,
onScanAborted = ::onScanAborted,
onScanProcessCompleted = ::openResultScreen,
callback = ::handleScanEvent,
onError = { measurementUUID, exception ->
// handle any errors
})
On iOS, the tire width is not necessary, and the input screen will not be displayed.
TireTreadScanViewConfig
The TireTreadScanView can be used directly without any additional configuration.
To modify the behavior, appearance, or metadata of the scan process, you can either use the TireTreadScanViewConfig object or a JSON representation of it.
The TireTreadScanViewConfig
provides, out of the box, everything needed for a successful scan, so you only need to define the specific properties that you want to change! The following properties are available:
-
measurementSystem
:MeasurementSystem.Metric
orMeasurementSystem.Imperial
.-
Default value:
MeasurementSystem.Metric
.
-
-
useDefaultHaptic
: Defines if the SDK can use of the device’s haptic feedback during the scan process to guide the users.-
Default value:
True
.
-
-
useDefaultUi
: Defines if the TireTreadScanView should display the Default UI.-
Default value:
True
.
-
-
defaultUiConfig
: Allows the customization of the Default UI.-
Defaul value: A default DefaultUiConfig instance.
-
Standard texts and elements will be displayed.
-
For customization, refer to the Default UI - Customizing page.
-
-
scanSpeed
:ScanSpeed.Fast
orScanSpeed.Slow
.-
Default value:
ScanSpeed.Fast
. -
Defines if the scan process should take 7 (Fast) or 10 (Slow) seconds.
-
Use the default value for passenger tires.
-
Chage this value to
Slow
for commercial tire measurements.
-
-
-
additionalContext
: Allows providing additional context to a measurement.-
Default value:
null
-
Check the Additional Context page for more information.
-
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 implementation.
To disable the audio feedback completely, remove these audio files from your application’s resources or rename them. |
Handling the TireTreadScanView
events
The TireTreadScanView
communicates back to your application via callback functions.
When using the default UI, your application only needs to implement behavior for the following callbacks from the SDK:
-
onScanAborted
: Invoked when the scanning process is aborted -
onScanProcessCompleted
: Invoked when the scanning process is completed -
onError
: Invoked when the scanning process ran into an error
Implementing behaviour for the To ignore it on iOS you can assign it to |
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 Results page to learn how to handle the measurement results.