DS5-AX User Manual Ver.0 2016. 03.17
57
Basic Implementation
In case decode data without AIDL, The decoded data is spread by Broadcast. Two action shall be required, such as Declaration and registry.
- Example of global declaration of broadcast
BroadcastReceiver mBarcodeReadBroadCast = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("app.dsic.barcodetray.BARCODE_BR_DECODING_DATA")) {
BarcodeDeclaration.SYMBOLOGY_IDENT symbology_ident =
BarcodeDeclaration.SYMBOLOGY_IDENT.fromInteger(
intent.getIntExtra("EXTRA_BARCODE_DECODED_SYMBOLE", -1));
TextView editText = (TextView) findViewById(R.id.editText);
if (symbology_ident != BarcodeDeclaration.SYMBOLOGY_IDENT.NOT_READ) {
String data =
"["+symbology_ident.toString()+"]"+
intent.getStringExtra("EXTRA_BARCODE_DECODED_DATA");
editText.setText(data);
}else
{
editText.setText("NOT READ");
}
}
}