FLAG_SECURE is not working

Hello Guys,

Why this code is not working??? I searched on google but :(:(:(:frowning:
I am really tired

    private static String error;
   
    public static String SetScreenCapture()
    {
        try
        {
            UnityPlayer.currentActivity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(UnityPlayer.currentActivity, "Screen capture OFF", Toast.LENGTH_LONG).show();
                    UnityPlayer.currentActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
                    error = "Called";
                }
            });
        }
        catch (Exception e) {
            error = e.toString();
        }
       
        return error;
    }

This is my java plugin code. When I called SetScreenCapture method…

  1. Toast is visible properly
  2. Then returning empty string

Please help me

no reply :(:(:frowning:

;);):(:(:(:(:(:frowning: