SurfaceView: It provides a dedicated drawing surface embedded inside the view hierarchy. Here we have something called a sufaceview in android and a textview field to display the text scanned by the barcode. Now your view should look something like this Open your activity_main.xml file and write the below code inside. Now you have set up all the dependency needed for the barcode scanner to work and all the permission necessary. Here’s a full view of my manifest file –> -> Ĥ.
Īlso, add the metadata field in your manifest file, inside the application tag and above the activity tag. Once the build is complete open up your manifest file and add the necessary permissions. Now hit on Sync now button and wait for the build to complete. Implementation ':play-services-vision:11.0.2'ģ.
The latest version of Android Studio installed.This article will guide you through creating an android application using which you can make use of your mobile camera to scan a barcode and read the data in them.