Read More

Barcode Scanning using Firebase ML kit

In order to get the information from the barcode and trigger the action, We can use ML kit’s barcode scanning API.
Steps to implement Firebase ML kit
1. We have to add Firebase in the project.
2. Add the dependencies for the ML Kit Android libraries to your module (app-level) Gradle file (usually app/build.gradle)<

Configure Barcode detector
It will be better to know the formate of the barcode in order to improve performance and getting the information
The following formats are supported:-Code 128 (FORMAT_CODE_128), Code 39 (FORMAT_CODE_39), Code 93 (FORMAT_CODE_93), Codabar (FORMAT_CODABAR), EAN-13, (FORMAT_EAN_13), Aztec (FORMAT_AZTEC), Data Matrix (FORMAT_DATA_MATRIX)

Run the Barcode Detector
1. Create FirebaseVisionImage object.
FirebaseVisionImage image = FirebaseVisionImage.fromMediaImage(media_image, rotation);
We can also get the instance of FirebaseVisionImage object from a file URI.

2. Create an instance of FirebaseVisionBarcodeDetector:

3. Finally, pass the image to the “detectInImage” method:

Get Information from barcodes

You can also go through the following link in order to get details:-
https://firebase.google.com/docs/ml-kit/android/read-barcodes
https://github.com/firebase/mlkit-material-android

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close