I am creating an attendance app in which I want to block floating apps (like WhatsApp) to prevent sharing of code, I want to block or detect floating apps. Below I have shared an image of the floating app.
What I have tried:
Adding setOnFocusChangeListener to my Edittext where code is entered to know if focus goes to another app, But even on changing focus to other apps my setOnFocusChangeListener is not working, Below is the code I used:
codeView.setOnFocusChangeListener((v, hasFocus) -> { if (!hasFocus) { checkCurrentRollNoAndRemoveAttendance(); } });
Prevent losing focus on EditText when clicking on a button in Android