3

Due to security reason, I would like to hide the content of the apps when it goes background.

Understand that using below method could done this job, but I would like to have the screenshot function still working.

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

Is there any workaround or other kind of method that could hide/blur the content of the apps when it goes background without compromise the screenshot function?

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
KS Tan
  • 31
  • 2
  • 1
    Instead of using FLAG_SECURE try setting the thumbnail manually (to a black screen or something secure like that). http://stackoverflow.com/a/31012018/833647 – Ken Wolf Mar 04 '16 at 11:35
  • onCreateThumbnail seems to be not supported anymore on Android framework. Do you still have alternatives on this issue? – KS Tan Mar 07 '16 at 08:59
  • Sorry, I'm out of ideas! Good luck! :) – Ken Wolf Mar 07 '16 at 09:09
  • 1
    I still need a solution for this, did you had any solutions yet? – Dennis Anderson Apr 26 '18 at 10:06
  • Any other solution for that issue on these days? :( – Emre Tekin Nov 25 '19 at 08:57
  • We can use the below code on base activity to do that --> public override fun onPause() { window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) super.onPause() } public override fun onResume() { super.onResume() window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) } – AmarDurai Nov 04 '22 at 08:44

0 Answers0