I'm writing an application, which has an activity that can be displayed on the lock screen also. A body of the activity has some inputs, buttons and ability to close. When the activity runs normally, everything works fine, inputs are editable, buttons are clickable, logic is runnig, etc.
But when I lock the screen while showing the activity or the activity pops on the lock screen and I enter a text input, the on-screen keyboard is not showing up.
I don't want the keyboard to be always visible, but to show and dismiss when appropriate. In short, to be working exactly like in a normal activity.
On my onCreate method I call the following method:
private void setWindowFlags() {
Window window = getWindow();
window.setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
// window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
// window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true);
setTurnScreenOn(true);
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
}
What am I missing?
[Edit] The problem might be in the keyboard self-closing rather than not showing up. Sometimes it is visible for just one frame.