0

i know this one,

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

but it only prevents screenshot from current app/app which is used to disable screenshot [app/activity only]

later, i kind of get the code,

WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_SECURE,
                    PixelFormat.TRANSPARENT);
                params.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                params.gravity = Gravity.CENTER;
                mView = new LinearLayout(ctx);
                View  btn = new View(ctx);
                mView.addView(btn);
                wm.addView(mView, params);

from, Rizwan

but it shows different errors

so,

is there a right way to prevent screenshot & screen recording across all apps

ANDuser
  • 71
  • 8
  • why do you want to disable screenshots across all apps? You are pretty much restricted to your own app when it comes to a lot of things with Android, so there is probably no supported way of doing that. – Ascendise Mar 10 '23 at 15:26
  • @Ascendise , as a part of a security project – ANDuser Mar 29 '23 at 03:03

0 Answers0