Herunterladen Inhalt Inhalt Diese Seite drucken

Werock Scoria M240 Betriebsanleitung Seite 119

Inhaltsverzeichnis

Werbung

Verfügbare Sprachen

Verfügbare Sprachen

then start the scanning process.
// Scan code button broadcast response
BroadcastReceiver
@Override
public void
onReceive(Context
switch
(intent.getAction()) {
case
case
case
// Press to start scanning
Scanner.startDecode();
break;
case
case
case
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 User Manual
triggerReceiver
=
new
context,
ACTION_KEYEVENT_SCAN_F_DOWN:
ACTION_KEYEVENT_SCAN_L_DOWN:
ACTION_KEYEVENT_SCAN_R_DOWN:
ACTION_KEYEVENT_SCAN_F_UP:
ACTION_KEYEVENT_SCAN_L_UP:
ACTION_KEYEVENT_SCAN_R_UP:
119 / 120
BroadcastReceiver() {
Intent
intent) {

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis