r/androiddev • u/Green-Campaign101 • Oct 21 '26
Question Preventing screenshots in recording and recent thumbnails or task switcher and showing black screen
Hi, I’ve been working on an app that has one main Activity and uses other Composables as screens.
I need to prevent screenshots and ensure that the app content is hidden or replaced with a black screen when it appears in the Recent Apps thumbnails or task switcher.
- "FLAG_SECURE"
"FLAG_SECURE" helps prevent screenshots and screen recordings, but it doesn't seem to solve the issue with Recent Apps thumbnails on all Android versions.
- Android 13 (API 33) and above
I was able to make the Recent Apps thumbnails display a black screen on devices running API 33 and above by using "setRecentsScreenshotEnabled()" and "Activity.setTaskDescription()", with the background color set to black.
- Android versions below API 33
However, on devices running Android versions below API 33, the Recent Apps thumbnails still appear white or black instead of consistently displaying a black screen.
Is there any way to reliably display a black screen in both Recent Apps thumbnails and screen recordings across Android versions, including those below API 33?
