banner



How To Use Camera In Android Development For Reading And Parsing 3d Barcode

Android QR Code / Bar Lawmaking Scanner

During the development of an android awarding, sometimes information technology is required to provide a functionality that scans a QR code or barcode. Scanning the QR code tin be done programmatically past using many means:

  • Using a web-based API solution, where the QR code or barcode is uploaded to the server, and the server returns the results.
  • Using a spider web-based application that accesses your camera and scans the QR code or barcode and returns the results.
  • Past Integrating the Mobile Vision API of Google Play Service.

Android QR Code Scanner Example

In this example, we will scan the QR code of a spider web URL and Email address, and act on it. Hither nosotros will use the Mobile Vision API of Google Play Service to scan the QR code. The Mobile Vision API supports the following formats of the barcode.

  • 1D barcodes: EAN-8, UPC-A, EAN-13, EAN-eight, UPC-E, Code-93, Code-128, Code-39, Codabar, ITF.
  • 2D barcodes: QR Code, Data Matrix, AZTEC, PDF-417.

Create an activity_main.xml and add the following code.

activity_main.xml


Create an activity_scanned_barcode.xml layout and add the post-obit code. The SurfaceView widget is used for camera source.

activity_scanned_barcode.xml


Create an activity_email.xml layout to perform e-mail activity.

activity_email.xml


Add together the Google Mobile Vision API in build.gradle file.

build.gradle


In the MainActivity.java file, add the following code. By clicking the push button btnScanBarcode it call the ScannedBarcodeActivity.java grade.

MainActivity.java


In the ScannedBarcodeActivity.java activeness class, add the following code. This class scans the QR lawmaking through the photographic camera. In this class, we will generate two QR code, one for web URL and some other is for an email address. A QR lawmaking can exist generated from whatsoever of QR code generator website.

ScannedBarcodeActivity.java


In the EmailActivity.java class, add together the post-obit code. This class performs the email sending task to the address mention in the QR lawmaking.

EmailActivity.java


Add the post-obit lawmaking in AndroidMenifest.xml file.

AndroidMenifest.java

Output:

Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner Android QR Code or Bar Code Scanner

Source: https://www.javatpoint.com/android-qr-code-or-bar-code-scanner

Posted by: rosafrover.blogspot.com

0 Response to "How To Use Camera In Android Development For Reading And Parsing 3d Barcode"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel