You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FLAG_SECURE not working on Google Pixel devices #2132
Is there a StackOverflow question about this issue?
I have searched StackOverflow
What happened?
I am developing an Android application using the View/XML approach and need to prevent screenshots and screen recordings. To achieve this, I have enabled FLAG_SECURE using:
window?.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
This works as expected on most devices, where screenshots and screen recordings are blocked successfully.
However, I have observed different behavior on Google Pixel devices (tested on Pixel 4 and Pixel 9). When a video is played in fullscreen mode using JW Player, users are still able to capture the screen, suggesting that FLAG_SECURE is not being enforced for the fullscreen video view.
Am I missing any additional configuration or implementation step for fullscreen video playback with JW Player? Does JW Player create a separate window/activity that requires FLAG_SECURE to be applied separately?
Additional details:
UI framework: View/XML (not Compose)
Video player: JW Player
Devices tested: Google Pixel 4 and Pixel 9
Android versions: 16 & 13
No errors or crashes are observed; the issue is only that screen capture is not blocked during fullscreen playback.
What could be causing FLAG_SECURE to be ineffective in this specific fullscreen video scenario on Pixel devices?
Activity
fix: Enable FLAG_SECURE to prevent screenshots and screen recordings