Show black preview screen in task manager on ICS
Asked Answered
A

1

5

I want to show a black screen in the task manager preview under Ice Cream Sandwich, like the German 'finanzstatus' app does. It would be nice if someone could point me in the right direction.

Amundson answered 2/4, 2012 at 21:26 Comment(5)
1. Could you point us to a picture of what you want to achieve for better understanding. 2. Why would you want to do that? If one app would do that, as a user I wouldn't see that as a feature, more as a bug.Frasch
here is the picture: link, i want to do that because i have sensitive data in my app (personal data). i do an automatic logout if the user suspend the app (running in background).Amundson
I have right now no equipment to write a small test program but as much I remember the snapshot is taken at the moment you activity is paused. I would give it a try and override the onPause function and alter the view in there. And first after the view is altered call the original onPauseFrasch
I have the same problem: if you have found a solution, can you please post it? thx!Irbm
Yes you need to add flag.secure to the windowmanager. But be careful at android version < 3!Amundson
H
9

Using FLAG_SECURE will block your app from screenshots, including the recent tasks list:

public class FlagSecureTestActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(LayoutParams.FLAG_SECURE,
                         LayoutParams.FLAG_SECURE);

    setContentView(R.layout.main);
  }
}
Hygroscopic answered 28/9, 2012 at 12:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.