I have a scanner that connects via Bluetooth but I need to capture what it scans when the screen is off.
Can it be done with a BroadcastReceiver? or some idea of how to start
I have a scanner that connects via Bluetooth but I need to capture what it scans when the screen is off.
Can it be done with a BroadcastReceiver? or some idea of how to start
The solution for this requirement was to place the screen in unlock mode none, implement the method onKeyIme()
and it is very important to get the text in event.ACTION_UP
since the event.ACTION_DOWN
is the one that unlocks the screen therefore the character entry is lost.
if (keyCode == event.KEYCODE_BACK && getAction() == event.ACTION_DOWN ){
Log.i(EntregaStreetActivity.class.getName(),"back");
}else if( event.getAction() == event.ACTION_UP){
barcodebuffer += Character.toString((char) event.getUnicodeChar());
Log.i(EntregaStreetActivity.class.getName(), "filterBarcodeKeys Char: "+ Character.toString((char) event.getUnicodeChar()));
}