Enable Barcode Scanning from Browsers on Android

Android Barcode Scanner

How to turn an Android phone into a barcode scanner? You can either implement the barcode recognition on the client side or the server side. In this article, we are introducing a sample which implements barcode reading on the server side. The client side can be a browser on either Android or PC. The sample demonstrates how to use Dynamsoft Barcode Reader SDK and Java WebSocket for webcam image capture and barcode decoding.

Barcode Reading Live Demo

Demo: http://app.dynamsoft.com/dbr
This is an online barcode scanner for Chrome & Firefox on Android and PC.
Due to the security enhancement implemented in Chrome v47, the above http demo is not working any more. Please refer to this HTTPS barcode reading demo instead.

Prerequisites

Download the Sample Code

Download the code of the HTTP sample

How to Run the HTTP Sample Code

After downloading and unzipping the sample code, you will see a folder like this one:

You can follow the steps below to get it running:

  1. Deploy the client to a Web server: Apache, IIS, Nginx or others. E.g. http://192.168.8.84:8000.
  2. Import the websocket-server project to eclipse.
  3. Copy DynamsoftBarcodeJNIx64.dll and DynamsoftBarcodeReaderx64.dll from %Dynamsoft Barcode Reader%\Samples\Java\BarcodeReaderDemo\src to the project root directory.
  4. Import Jetty WebSocket libraries.
  5. Build and run the WebSocket server.
  6. Open video.js and change the WebSocket IP address and port. E.g.
    var ws = new WebSocket("ws://192.168.8.84:88");
  7. Visit http://192.168.8.84:8000 in Chrome.
  8. Select a Webcam source. On mobile devices, you can toggle between front-facing camera and back-facing camera.
  9. Click button to detect barcode.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.

Subscribename@email.com