Show soft keyboard even though a hardware keyboard is connected

Viewed 13857

Is there any way to show software keyboard with USB keyboard connected (in my case RFID reader)?
I tried to force show it using InputManager (with these or similar parameters), but with no luck

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Important notice - I know that there is a button in status/system bar to show it, but this button is not visible to user (Kiosk app).

5 Answers

If your app has the WRITE_SECURE_SETTINGS permission (available to system apps or Android Things apps) it can set the show_ime_with_hard_keyboard system setting which will enable soft keyboard even if a hard keyboard is plugged:

Settings.Secure.putInt(getContentResolver(), "show_ime_with_hard_keyboard", 1);
Related