Memor 10 turn on/off scanner by broadcast intent

Hello,

Is there a way to turn on and off the scanner by sending a broadcast intent?
I mean something like:
val intent = Intent()
intent.action = “com.datalogic.some_api”
intent.putExtra(“some_parameter”, “disable_scanner”)
sendBroadcast(intent)

Hello,
Welcome on this forum,

unfortunately at the moment a broadcast intent that enables/disables the scanner is not available.

As suggestion you can develop a receiver (documentation here) that through an explicit intent can enable/disable the scanner with this code (reference here) :

import com.datalogic.device.input.KeyboardManager;
import com.datalogic.device.input.Trigger;

......

KeyboardManager keyManager = new KeyboardManager();
for (Trigger trigger : keyManager.getAvailableTriggers()) {
    boolean result =  trigger.setEnabled(false); 

    if(result){
        //operation done
    }else{
        //do something in case of failure
    }
}

if you need more information on this topic please contact our technical support:
https://www.datalogic.com/eng/contact-us/technical-support-cts-8.html

Best Regards
Donato

1 Like