Search code examples
androidscreenshotandroid-recents

Hide screen in 'Recent Apps List', but allow screenshots


I mainly want to blank the screen in the recent apps list due to sensitive data being shown. For this, the solution is to use:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);

but this also disallows screenshots, which is a problem.

Is there a way to show a blank screen (or a predefined image) in the recent apps list, while still allowing screenshots?


Solution

  • I think what you need is:

    android:excludeFromRecents="true"
    

    put that in your android manifest inside your <activity>(activity you want to exclude from recents)</activity>