Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add more flags to show when phone is looked #98

Open
ufoloko opened this issue Feb 16, 2024 · 2 comments
Open

Please add more flags to show when phone is looked #98

ufoloko opened this issue Feb 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ufoloko
Copy link

ufoloko commented Feb 16, 2024

if phone is looked and app is in background, if a service needs to show window, is not working.

I think you can add those flags

WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON

to be able to show window even when screen is looked

@nambui2000k
Copy link

Yes. I have same request

@X-SLAYER X-SLAYER added the enhancement New feature or request label Mar 3, 2024
@Ridham-Vaghani
Copy link

Ridham-Vaghani commented Mar 26, 2024

I did R&D on that and to show dialog over lock screen need to add some permissions

Need to add below permissions in AndroidManifest:
"android.permission.FOREGROUND_SERVICE"
"android.permission.WAKE_LOCK"
"android.permission.SYSTEM_ALERT_WINDOW"

Now come to native part of the package there is one java file WindowSetup.Java and need to add following code for setFlag() method:
static void setFlag(String name) {
if (name.equalsIgnoreCase("flagNotFocusable") || name.equalsIgnoreCase("defaultFlag")) {
flag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
}
if (name.equalsIgnoreCase("flagNotTouchable") || name.equalsIgnoreCase("clickThrough")) {
flag = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
}
if (name.equalsIgnoreCase("flagNotTouchModal") || name.equalsIgnoreCase("focusPointer")) {
flag = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
}
}

I hope it will be useful for other. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants