Ionic 2 “Support” on Zebra Enterprise Devices
Over the past few months I have seen an increasing number of questions around using Ionic 2 on Zebra Enterprise devices. Right now there is no official Ionic Native plugin to easily expose scanning and other enterprise functionality available on Zebra devices.
What you can do (and this seems to be the most popular approach here) is to use DataWedge on the device to control scanning functionality and have DataWedge output an Intent whenever a barcode is scanned. The Ionic 2 application just then has to listen for the intents coming from DataWedge and voila, it has received scanned data.
Obviously, Ionic 2 relies on Cordova to deploy to mobile devices. Previously I have written about integrating DataWedge with your Cordova application but that was written back in August 2016 and since that time there has been an increasing prevalence of TypeScript and the paradigm shift between Angular 1.x and Angular 2.x (and Ionic 1.x to 2.x). A number of developers were relying on the advice given for Cordova and fitting that square peg into the round hole of an Ionic 2 application.
My advice for creating an Ionic 2 application to run on Zebra enterprise mobile computers is as follows:
- Use DataWedge to control the scanner and have DataWedge output Intents on each successful scan
- Receive those Intents in your Ionic 2 application with the WebIntent native plugin, https://ionicframework.com/docs/native/web-intent/
- Note: There seems to be some problem with webIntent.registerBroadcastReceiver not exposing a callback, I advise calling into the implementation of webIntent directly:
- Control DataWedge (if required) via the DataWedge Intent API also using the WebIntent native plugin, https://ionicframework.com/docs/native/web-intent/
To help get you started, I have put together a very simple sample application, https://github.com/darryncampbell/DataWedgeIonic2. This sample app will only receive intents via DW, not send them via the DW Intent API but it should be enough to get going. Please see the ReadMe for setup instructions. It is tested with the latest versions (at the time of writing) of Ionic (3.19.0), Cordova (7.1.0) and Cordova’s Android platform (6.3.0)