3

I have an Android game created with help of libGDX. I want to disable the ability to take screenshots.

For regular android activities you can use getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); method. It works fine.

But it doesn't work with activities extended from com.badlogic.gdx.backends.android.AndroidApplication. I'm still able to take screenshots.

Any ideas?

alan_derua
  • 2,252
  • 3
  • 20
  • 19

1 Answers1

1

Calling initialize in AndroidApplication sets up the window parameters for a full-screen game, so it's overwriting your window parameters. So instead, put this in onCreate after you call initialize. Note that you should use addFlags instead of setFlags so you don't mess up the other flags that Libgdx set.

getWindow().addFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
Tenfour04
  • 83,111
  • 11
  • 94
  • 154