Skip to content

FX325 Imager (Android 10)

The FX325 has a built-in BarcodeImager to scan 1D and 2D barcodes. The barcode reader can be use in two modes:

  • Keyboard emulation mode : Accessible directly from the settings or from an SDK (Barcode service manager library)
  • Custom mode : To have fine-grained control on the reader. With the usage of another SDK (Barcode reader)

In order to use the barcode within you app, you also need to add following permissions inside your AndroidManifest.xml:

<uses-permission android:name="android.permission.BARCODE_SCANNER" />
<uses-permission android:name="android.permission.CAMERA" />

Usage in keyboard emulation mode

  • To activate the laser, you can use physical button on the left side of the device.
  • The result of the scan is displayed directly on the screen where your app has the focus (ex: Android TextField) or by catching the "OnKeyUp" event (cf. sample code)
  • The beam turns off after a code is read or after 10 seconds.

Demo application using an EditText

Alternative without using an EditText

public class MainActivity extends AppCompatActivity {
    private StringBuilder barcode;
    private TextView tvBarcode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tvBarcode = findViewById(R.id.tvBarcode);
        barcode = new StringBuilder();
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode != KeyEvent.KEYCODE_SHIFT_LEFT
                && keyCode != KeyEvent.KEYCODE_F1
                && keyCode != KeyEvent.KEYCODE_F2) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                Log.d(TAG, "decoded text = " + barcode);
                tvBarcode.setText(barcode);
                barcode = new StringBuilder();
            } else {
                barcode.append((char)event.getUnicodeChar());
            }
        }
        return true;
    }
}

Barcode service manager library (SDK with keyboard emulation mode)

The barcode service manager library can be used to configure the keyboard emulation mode. This can be helpful to avoid going into the settings to configure it, and also disable it in order to use the "custom mode".

Custom mode (applicable when you are not using the barcode reader in keyboard emulation mode)

The Barcode reader can be used programmatically with an SDK to enable scan mode, trigger scanning events, getting the results, and releasing the barcode reader.

Demo application controlling the barcode scanner