1

I have an Android banking app that prevents from taking a snapshot of the screen how do I do that in my own app.

Does anyone know how this is achieved?

Mck
  • 129
  • 1
  • 10

1 Answers1

1

It can be achieved by adding a simple code in the activity

if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}

Just add FLAG_SECURE flag in the activity. It Works for all Android versions higher than HONEYCOMB ie API 11 or higher.

Window flag: treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.

Thsi prevents screenrecording and screenshots

Tomin B Azhakathu
  • 2,656
  • 1
  • 19
  • 28