6

I need to hide my application screen from the list of running applications when you click the Recent Apps button in Android 4.x. The data that my application contains could leak sensitive information if someone were to have my application running in the background. I would still like my application to be shown in recent apps, just not the screenshot.

How do you do this?

Tyler
  • 19,113
  • 19
  • 94
  • 151
  • 1
    http://stackoverflow.com/questions/9130599/how-to-change-the-snapshot-shown-by-recent-apps-list In essence, its not possible to change the thumbnail, but it is possible to hide it. – MCWhitaker Aug 13 '13 at 21:47

1 Answers1

10

To exclude the application from recent apps you should do the following:

on Activity on Manifest android:excludeFromRecents="true" 

and you can disable thumbnail on the activity containing sensitive data by adding FLAG_SECURE to your window:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
Christian Fritz
  • 20,641
  • 3
  • 42
  • 71
Flaviano Gomes
  • 126
  • 2
  • 3
  • WindowManager.LayoutParams.FLAG_SECURE is works fine. But it is disables Screenshot option and also unable to do Automation testing(Because it needs to capture screen). – shobhan Nov 28 '16 at 09:50