▲ 2 r/android_devs
FLAG_SECURE not working on Google Pixel devices
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?.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
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 with JW Player?
u/Mckayfolker1830 — 14 days ago