If your way works, stick with it. On a related note: if your aim is to prevent users from manually typing barcodes, then bear in mind that a paste operation of copied text could be interpreted as a scan.
Looking at the device manual (I think):
there are two other methods that might work, assuming that the DataWedge scanner interface software/"driver" is being used.
1/ according to page 96, the barcode scanner has three output (send) methods:
- keystroke output
- intent output
- IP (network) output
and so perhaps you could use the intent or IP method. Presumably this would hide the barcodes from appearing on screen - bonus!
2/ according to page 121, the keyboard output method has options including:
- Prefix to data - Add characters to the beginning of the data when sent.
- Suffix to data - Add characters to the end of the data when sent.
and so you could use some non-barcodey hard-to-type character(s) to tag barcodes from the scanner
2.1/ another keyboard output option is:
- Send as hex - Set to send the data in hexadecimal format.
which might be useful if you don't want the user to see (human-)readable barcodes.
It should be possible to configure these items from your app, using intents.