Scoria M240 User Manual
119 / 120
then start the scanning process.
// Scan code button broadcast response
BroadcastReceiver
triggerReceiver
=
new
BroadcastReceiver
() {
@Override
public void
onReceive
(
Context
context,
Intent
intent) {
switch
(intent.getAction()) {
case
ACTION_KEYEVENT_SCAN_F_DOWN
:
case
ACTION_KEYEVENT_SCAN_L_DOWN
:
case
ACTION_KEYEVENT_SCAN_R_DOWN
:
// Press to start scanning
Scanner
.
startDecode
();
break
;
case
ACTION_KEYEVENT_SCAN_F_UP
:
case
ACTION_KEYEVENT_SCAN_L_UP
:
case
ACTION_KEYEVENT_SCAN_R_UP
:
default
:
// Pop up to stop scanning
Scanner
.
stopDecode
();
break
;
}
}
};
If you do not need to monitor the keystroke, you can use
Scanner.startDecode()
and
Scanner.stopDecode()
to call the function directly.
Note: If you need to trigger the scan process continuously, the interval between the last completion and the
next start should be more than 100 ms, otherwise the process may get stuck.
Simulate scan button to trigger the scan process
You can simulate the pressing of a scan button:
public static final String ACTION_KEYEVENT_SCAN_F_UP =
"com.android.action.keyevent.KEYCODE_KEYCODE_SCAN_F_UP";
public static final String ACTION_KEYEVENT_SCAN_F_DOWN =
"com.android.action.keyevent.KEYCODE_KEYCODE_SCAN_F_DOWN";
Get scan result
com.android.serial.BARCODEPORT_RECEIVEDDATA_ACTION
is the broadcast that means the scan
was successful. After receiving this broadcast, you just need to retrieve 'DATA' from Intent, then you can get
the scan data. The data type is a string.
public static final String BARCODEPORT_RECEIVEDDATA_ACTION =
"com.android.serial.BARCODEPORT_RECEIVEDDATA_ACTION";
public static final String BARCODEPORT_RECEIVEDDATA_EXTRA_DATA =
"DATA";
Change the status of the scanner
static final String ACTION_CHANGE_STATE_ENABLE =
"com.zebra.action.CHANGE_STATE_ENABLE";
static final String ACTION_CHANGE_STATE_DISABLE =
"com.zebra.action.CHANGE_STATE_DISABLE";
Release resources
When you exit the program completely, call
Scanner.release()
to release the scan port and resources.
Содержание Scoria M240
Страница 1: ...Copyright 2022 by WEROCK All Rights Reserved Scoria M240 User Manual ...
Страница 17: ...Scoria M240 User Manual 17 120 ...
Страница 24: ...Scoria M240 User Manual 24 120 ...
Страница 77: ...Scoria M240 User Manual 77 120 4 Now lift the battery by the tab provided and remove it ...
Страница 83: ...Scoria M240 User Manual 83 120 4 Now lift the battery by the tab provided and remove it ...