Android Question Android Device with Built In Scanner

colboy

Member
Licensed User
Longtime User
I have a Android device with a built in barcode scanner, not a camera. In the documentation it mentions about using AIDL files. Am I able to use these in B4A to operate the scanner.

Failing that I saw text relating to intents.

private ScanBroadcastReceiver scanBroadcastReceiver = null;

注册广播消息Register the broadcast message

if(scanBroadcastReceiver==null) { scanBroadcastReceiver = new ScanBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("com.zkc.scancode"); this.registerReceiver(scanBroadcastReceiver, intentFilter); }

广播消息类Broadcast message class

class ScanBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String text = intent.getExtras().getString("code"); Log.i("ScanBroadcastReceiver", "ScanBroadcastReceiver code:" + text); mComposing.append(text); commitTyped(getCurrentInputConnection()); ////keyDownUp(KeyEvent.KEYCODE_ENTER); } }

Is the barcode scanner automatically broadcasting using an Intent and can I consume this without using an SDK?

Thanks, Colin
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top