3

As per security concern screenshots of my app screen should not be shown in recent apps. I have tried adding android:excludeFromRecents="true" in all activities on the manifest file. However, screenshots are shown in recent apps, can some help me to solve this issue?

1 Answer 1

1

excludeFromRecents excludes from recents which is not what you need. Try setting FLAG_SECURE:

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

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

    setContentView(R.layout.main_layout;
  }
}
9
  • thanks for the reply,but this logic will stop the user to take the screenshot manually also,I cannot go with this.
    – csr
    Sep 27, 2012 at 10:06
  • threre's no other solution. If you want to secure your activity then it gets secured. You can't have half-baked screenshot security here. Sep 27, 2012 at 10:07
  • we tried with above logic,in recent app no screenshot of the app is shown,and teh same time we are not able to take the screenshot manually if user wants.
    – csr
    Sep 27, 2012 at 10:12
  • There's no other way at the moment. Either you block ability to take screenshot completely (which includes recents) or not. Judge what is more important to you and how many users would really need to take a screenshot of that activity Sep 27, 2012 at 10:14
  • hi,instead of screenshot in recent apps,can we show any other icon
    – csr
    Sep 28, 2012 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.