Based on : https://github.com/yuriy-budiyev/code-scanner
I would like to retrieve the data from firestore class when the barcode reader scans the barcode but I don't know how to do it. And also i want to proceed to the other page after scanned the barcode. Please help me to solve to it. Here is my code :
private fun codeScanner() {
codeScanner = CodeScanner(this, scanner_view)
codeScanner.apply {
camera = CodeScanner.CAMERA_BACK
formats = CodeScanner.ONE_DIMENSIONAL_FORMATS
autoFocusMode = AutoFocusMode.SAFE
isAutoFocusEnabled = true
isFlashEnabled = false
decodeCallback = DecodeCallback {
runOnUiThread {
tv_textView.text=it.text
}
}
errorCallback = ErrorCallback {
runOnUiThread {
Log.e("Scan", "Camera initialization error: ${it.message}")
}
}
}
scanner_view.setOnClickListener {
codeScanner.startPreview()
}
}
Here's how my data in firestore looks like: Firestore