Get Android scanner intent in Ionic


#1

I have a scanner device that comes with Android 4.2.2, and I need to make an Ionic app that can scan barcodes. The $cordovaBarcodeScanner plugin doesn’t help here, as it works only on mobile devices. Therefore, I think I need to capture the scanner intent somehow directly in my Ionic app, but I have no idea how could I do that.

I have this Java code example of how the scanner works:

public class BarcodeReceiver extends BroadcastReceiver { public void onReceive(Context ctx, Intent intent) { if (intent.getAction().equals(ACTION_BARCODE_SERVICE_BROADCAST)) { strBarcode = intent.getExtras().getString(KEY_BARCODE_STR); tvBarcode.setText(strBarcode); strBarcode = ""; } } }

I would appreciate any directions. Thanks!