How to prevent Screen Capture in Android
I'm going to say that it is not possible to completely prevent screen/video capture of any android app through supported means. But if you only want to block it for normal android devices, the SECURE FLAG is substantial.
1) The secure flag does block both normal screenshot and video capture.
Also documentation at this link says that
Window flag: treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.
Above solution will surely prevent applications from capturing Video of your app
See the answer here.
2) There are alternative means of capturing screen content.
It may be possible to capture the screen of another app on a rooted device or through using the SDK,
which both offer little to no chance of you either blocking it or receiving notification of it.
For example: there exists software to mirror your phone screen to your computer via the SDK and so screen capture software could be used there, undiscoverable by your app.
See the answer here.
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
Disable screenshot in Android application
I'm going to say that it is not possible to completely prevent screen/video capture of any android app through supported means. But if you only want to block it for normal android devices, the SECURE FLAG is substantial.
- The secure flag does block both normal screenshot and video capture.
Also documentation at this link says that
Window flag: treat the content of the window as secure, preventing
it from appearing in screenshots or from being viewed on non-secure
displays.Above solution will surely prevent applications from capturing Video
of your app
See the answer here.
- There are alternative means of capturing screen content.
It may be possible to capture the screen of another app on a rooted device or through using the SDK,
which both offer little to no chance of you either blocking it or receiving notification of it.
For example: there exists software to mirror your phone screen to your computer via the SDK and so screen capture software could be used there, undiscoverable by your app.
See the answer here.
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
How do I disable screenshot from an android application?
Use Flag Secure as a layout parameter flag.
Is there a way to completely block the ability to take screenshots in Android?
You can use the window LayoutParam FLAG_SECURE
. Add this to your onCreate
method:
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
More on this topic can be found here.
Related Topics
Is Asynctask Really Conceptually Flawed or Am I Just Missing Something
What Is Activity.Finish() Method Doing Exactly
Android Create Shortcuts on the Home Screen
How to Grant Modify_Phone_State Permission For Apps Ran on Gingerbread
How to Read a Text File from the Sd Card in Android
How to Have Onscrolllistener for a Scrollview
Android Get Real Path by Uri.Getpath()
Android Studio's Project Gradle File Changed
How to Change Spinner Text Size and Text Color
How to Hide Soft Keyboard on Android After Clicking Outside Edittext
Error:(1, 0) Plugin With Id 'Com.Android.Application' Not Found
Offline Speech Recognition in Android (Jellybean)
How to Add a Library Project to a Android Project