XuJin186/react-native-pda-scan

PDA scanner not working

Closed this issue · 3 comments

React native version: 0.63.2
PDA scanner device: ZKC PDA3501

Event callbacks provided in the usePdaScan hook not triggering.

const {code, error} = usePdaScan({
onEvent: (code) => {
console.tron.log('usePdaScan', code);
},
onError: (error) => {
console.tron.log('usePdaScan err', error);
},
trigger: 'always', //always: An event is triggered each time the code is scanned。 change:Events are triggered when changes occur
});

Can you please help me regarding this. Your package is the only hope of solving this feature for me

Thank you for your confidence

If Pda needs to be set, the bar code receiver should be set as broadcast receiver

Hi I was able to solve this issue by adding package to the PdaScanModule by following these instructions.

Are you open for me to contribute to your repository and if not here is the code.

Basically in JS, change hook to:
const {code, error} = usePdaScan({ onEvent: (code) => { console.log('usePdaScan', code); }, onError: (error) => { console.log('usePdaScan err', error); }, trigger: 'always', });

In PDAScanModule:

private static final String ZKC_SCAN_ACTION = "com.zkc.scancode";

if (ZKC_SCAN_ACTION.equals(actionName)) { params.putString("code", intent.getExtras().getString("code")); } else

IntentFilter zkcIntentFilter = new IntentFilter(); zkcIntentFilter.addAction(ZKC_SCAN_ACTION); getReactApplicationContext().registerReceiver(scanReceiver, zkcIntentFilter);

Hi I was able to solve this issue by adding package to the PdaScanModule by following these instructions.

Are you open for me to contribute to your repository and if not here is the code.

Basically in JS, change hook to:
const {code, error} = usePdaScan({ onEvent: (code) => { console.log('usePdaScan', code); }, onError: (error) => { console.log('usePdaScan err', error); }, trigger: 'always', });

In PDAScanModule:

private static final String ZKC_SCAN_ACTION = "com.zkc.scancode";

if (ZKC_SCAN_ACTION.equals(actionName)) { params.putString("code", intent.getExtras().getString("code")); } else

IntentFilter zkcIntentFilter = new IntentFilter(); zkcIntentFilter.addAction(ZKC_SCAN_ACTION); getReactApplicationContext().registerReceiver(scanReceiver, zkcIntentFilter);

You are always welcome to submit PR. Your problem is that this plug-in does not support this model of PDA