Skip to content

Instantly share code, notes, and snippets.

@the-dagger
Last active June 28, 2018 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-dagger/44c799a001df5c8d7bb8187432027eee to your computer and use it in GitHub Desktop.
Save the-dagger/44c799a001df5c8d7bb8187432027eee to your computer and use it in GitHub Desktop.
private fun getQRCodeDetails(bitmap: Bitmap) {
...
detector.detectInImage(image)
.addOnSuccessListener {
for (firebaseBarcode in it) {
...
when (firebaseBarcode.valueType) {
//Handle the URL here
FirebaseVisionBarcode.TYPE_URL -> firebaseBarcode.url
// Handle the contact info here, i.e. address, name, phone, etc.
FirebaseVisionBarcode.TYPE_CONTACT_INFO -> firebaseBarcode.contactInfo
// Handle the wifi here, i.e. firebaseBarcode.wifi.ssid, etc.
FirebaseVisionBarcode.TYPE_WIFI -> firebaseBarcode.wifi
//Handle more types
}
}
}
.addOnFailureListener {
it.printStackTrace()
Toast.makeText(baseContext, "Sorry, something went wrong!", Toast.LENGTH_SHORT).show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment