User Corrected Results

User Corrected Results (UCR) lets your end-users tell Anyline when a scan was wrong: they simply type the value they should have received and send the corrected result to Anyline to improve future accuracy.

Prerequisites

UCR is opt-in, and you decide how it is implemented in your app. Additionally, your Anyline License Key needs to have the relevant flag enabled for UCR. Please contact your CSM or Support for further information.

Reporting a corrected result

After a successful scan, you can provide your end user with a UI element to correct the scanned data. To send this corrected data to Anyline, you have two options:

  1. via instance method, using the ScanResult object

    • convenient for usage directly after scanning.

  2. via class method, using the blobKey

    • in case you store the blobKey for later reference.

Instance method - using ScanResult

  • Kotlin

  • Java

// assume `scanResult` is a ScanResult you just received
try {
    val response = scanResult.reportCorrectedResult("this is the correct value")
    // Do something with the response, e.g. log it or update UI
    println("Correction sent, response: $response")
} catch (e: IllegalArgumentException) {
    // Handle invalid input (e.g. empty or malformed correctedResult)
    e.printStackTrace()          // or show a Snackbar / Toast, etc.
}
// assume `scanResult` is a ScanResult you just received
try {
    String response = scanResult.reportCorrectedResult("this is the correct value");
    // use the response...
} catch (IllegalArgumentException e) {
    // handle the bad-input case
}

Class method - using blobKey

  • Kotlin

  • Java

val blobKey = "Your blobKey"
val correctedResult = "Your corrected result"
try {
    val response = ScanResult.reportCorrectedResultFromBlobKey(blobKey, correctedResult)
    println("Correction sent, response: $response")
} catch (exception: IllegalArgumentException) {
    println("Failed to report correction: $exception")
}
String blobKey = "Your blobKey";
String correctedResult = "Your corrected result";
try {
    String response = ScanResult.reportCorrectedResultFromBlobKey(blobKey, correctedResult);
    System.out.println("Correction sent, response: " + response);
} catch (IllegalArgumentException e) {
    System.out.println("Failed to report correction: " + e.getMessage());
}

Wait about 1 second after the original scan call before reporting the correction so the backend has the original result first.