androidreact-nativedatawedge

Is it possible to set default app for Zebra barcode scanner?


I'm created small react native app for Zebra TC20 barcode scanner. It works just fine. The main issue I need to solve is somehow open my app on scan button press...

By default when scan button is pressed and if my app is not running the DWDemo app launches and shows scanned data. And I need that by default would be opened my app.

I'm using https://github.com/darryncampbell/react-native-datawedge-intents to get barcodes. And it uses DeviceEventEmitter.

Maybe there are some techniques to register listener in foreground for specific event and start the app ?


Solution

  • That React module (which I'm the author of by the way :) ) is hardcoded to assume that scan data will be sent via a Broadcast Intent. I did it this way because the DataWedge API can only communicate with the application via Broadcast Intents however scan data is not sent via the DataWedge API, it is sent via the DataWedge Intent output plugin which CAN support both startActivity and startService.

    By default the device, out of the box, will not launch DWDemo when a barcode is scanned. If you launch DataWedge you will see a number of profiles, one of which will be the 'default' profile which is used when no other profile is in effect (i.e. no app associated with a specific profile is in the foreground) - you can configure this default profile to specify Intent delivery as StartActivity and I assume whatever profile is default on your device is invoking the DWDemo app.

    So, to achieve what you want to achieve you would need to: