Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Younes-Charfaoui/49d0a43063249a4e98266af23f59d634 to your computer and use it in GitHub Desktop.
Save Younes-Charfaoui/49d0a43063249a4e98266af23f59d634 to your computer and use it in GitHub Desktop.
private fun scanImageForBarcode(it: BitmapPhoto) {
val inputImage = InputImage.fromBitmap(it.bitmap, it.rotationDegrees)
val task = barcodeScanner.process(inputImage)
task.addOnSuccessListener { barCodesList ->
for (barcodeObject in barCodesList) {
val barcodeValue = barcodeObject.rawValue
Log.d("Barcode", "The code %s".format(barcodeValue))
}
}
task.addOnFailureListener {
Log.d("ERROR", "An Exception occurred", it)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment