How to get the Caps Lock, YELLOW or BLUE keyboard state on Datalogic Android Devices

Caps Lock is a standard Android Keyboard state, and is directly notified by the onKeyDown() Android event.

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (event.isCapsLockOn()) {
    return super.onKeyDown(keyCode, event);

Yellow or Blue, instead, are two special “Keyboard Layout” defined in the Datalogic keyboard architecture. To get that information you can rely to the AdvancedKeyboard class from Datalogic SDK.
(see…AdvancedKeyboard.html) .

KeyboardManager km = new KeyboardManager();
AdvancedKeyboard ak = km.getAdvancedKeyboard();

Now you have two options:

  1. Use getCurrentLayoutIndex() to know the status (0 = none, 1 = yellow, 2 = blue):

     Integer idx = ak.getCurrentLayoutIndex();
     Log.d("getCurrentLayoutIndex(): ", idx.toString()); 
  2. Add an event listener to AdvancedKeyboard.LayoutChangeEventListener to be notified when the keyboard state changes, then check the LayoutId returned by the event onLayoutChanged(int layoutId):

     AdvancedKeyboard.LayoutChangeEventListener listener = new AdvancedKeyboard.LayoutChangeEventListener() {
         public void onLayoutChanged(int layoutId) {
             Log.d("onLayoutChanged(): ", String.valueOf(layoutId));

Here below the same sample code in Kotlin:

    val km = KeyboardManager()
    val ak = km.advancedKeyboard

    var idx = ak.currentLayoutIndex
    Log.d("getCurrentLayoutIndex(): ", idx.toString())

    var listener = object : AdvancedKeyboard.LayoutChangeEventListener {
        override fun onLayoutChanged(layoutId: Int) {
            Log.d("onLayoutChanged(): ", layoutId.toString())

Simone Callegari
Mobile Products L3 Specialist SW Engineer

1 Like

Hello @Simone_Callegari ,

I’m working on an App for the Memor K. I have tried to use your sample code from your above Post.

But I only get null from the getAdvancedKeyboard Method. I wanted to change the MultitapDelay because i get some Multiple Reads with the Front Trigger on the Memor K.

Is this API available on every Device?

Thanks for your reply,
Best regards,

Hello @Stefan_Klammer ,

Unfortunately, despite the presence of SDK 1.22 onboard, Memor K does not include the Advanced Keyboard functionalities available on Skorpio X5, that allow the Multitap delay management or the option for installing Custom Keyboard Layouts.

But I don’t perfectly understand what you mean with “get some Multiple Reads with the Front Trigger”.

If you need to insert a delay after each code reading, you can temporarily disable the device’s triggers (or the Keyboard Wedge depending on the architecture of your your application) and then enable them again after a defined period of time, or when the logic of your application determined that you can read a new label.
You can find more information in the article: How to enable/disable the Scan Engine through Android Studio SDK

If you need more support, consider also to open a tech request via the company’s tech support portal available here

Simone Callegari
Mobile Products L3 Specialist SW Engineer

1 Like

Hello @Simone_Callegari,

thank you for your response. I mean if you press the front Trigger Key and keep it pressed you will sometimes multiple reads. If you press the key not perfectly in the center, the propability to get multiple reads is higher. With multiple reads I mean there are full cycles of “illumination with aim dot followed by green spot” and so on. I could send you a video were the behaviour is recorded.

This Behaviour is not limited to my application, the pre installed “Scan Demo” App also behaves like this.

In the datalogic settings i have set the scanner options to No Delay.

I think with a debounce/multitap delay this behaviour could be improved.

We have also made a tech request.

Thank you,
Best regards,

Hello Community,
Dear @Simone_Callegari ,

i have another question to the Blue and Yellow Function Key on the Memor K. Is there a possibility to get the State of this two function keys?

The Problem is that i have some textview’s which are numeric and if a function key is pressed and the Memor K shows Fn oder a in the right top corner it is not possible to input numbers with the keyboard.

Thank you for your help,
Best regards,

Hello @Stefan_Klammer,
Unfortunately, today it is not possible to know or change the status (numeric, alpha, functions) of the keyboard on Memor K via code (FW v1.01.08).

On the other devices that support the AdvancedKeyboard features, is possible to know or change the status of the Blue and Yellow keys ad described in the article above.

Simone Callegari
Datalogic Mobile Products Specialist - SW Engineer