DXU HTTP APIs: how to use a Datalogic Scan Engine in an html page

Today, also for Mobile applications it is very common to have a web application deployed in a server and the browser on mobile device to be used as client.
This lecture wants to show a simple way on how to use a Datalogic Scan Engine from a simple html page.
The Datalogic DXU Agent preinstalled in all our devices provides also some useful HTTP endpoints that can be used by local or remote applications to control the scanner.
The complete list of the endpoints and in which version of DXU Agent are available at the page DXU HTTP APIs ( see: https://datalogic.github.io/dxu/android-http-api ).

So, for example, if you need to enable/disable the scanner in some input fields, you can send an http request through javascript.


  • DXU service version is equal or major than 1.29 (repository available here don’t forget to restart the DXU service if you do an update)
  • DXU service is enabled on your device and the port is 8080.

TIP: to check the DXU service status:
Open DXU Agent app:
click menu -> Settings -> Enable service
click menu -> Advanced settings -> Device HTTP server port.
( see: https://datalogic.github.io/dxu/connect-to-devices ).

Code example
(download here):

<!DOCTYPE html>
<head><meta name="viewport" content="width=device-width, initial-scale=1"></head>


<h1>DXU HTTP APIs sample</h1>

Enable triggers: &nbsp;<input type="text" name="disbale" onfocus="enableTriggers()"><br>
Disable triggers: &nbsp;<input type="text" name="enable"  onfocus="disableTriggers()"><br>

<p id="demo"></p>


 function enableTriggers()
   const Http = new XMLHttpRequest();
   const url='http://localhost:8080/scan?action=enable_all_triggers';
   Http.open("GET", url);

 function disableTriggers()
   const Http = new XMLHttpRequest();
   const url='http://localhost:8080/scan?action=disable_all_triggers';
   Http.open("GET", url);


If you open this page with Chrome on the device, you can see that only when the focus is on field “Enable trigger” the scan engine works, this page can also be hosted in an Http server.
The Datalogic Android HTTP API can also be used in applications that use a web views
(see the example DecodeHTTPSampleAPI ).