Prevent other applications form capturing/recording screen
You can secure screen capturing functionality by adding FLAG_SECURE into your Activity as follows
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
Check this link which says
Screen capturing and sharing
Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.
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
Prevent screen capturing softwares to capture an application screen
I have achieved this by using SetWindowDisplayAffinity, as per MSDN
The display affinity setting. This setting specifies where the window's contents are can be displayed. Set this value to WDA_MONITOR to display the window's contents only on a monitor. Set this value to WDA_NONE to remove the monitor-only affinity.
So setting WDA_MONITOR
to handle of WinForm
makes it black when print screen or desktop recording or in desktop sharing application.
Image captured through mobile:
However, I am open for any other (better) answer for this.
Related Topics
Refresh/Reload/Re Instantiate a Fragment in an Android Tab System
Android Studio - Failed to Apply Plugin [Id 'Com.Android.Application']
How to Set Transparency of a Background Image Android Xml File
How to Set the Height of an Item Row in Gridlayoutmanager
Android: Textview: Remove Spacing and Padding on Top and Bottom
Android How to Get Current Positon on Recyclerview That User Scrolled to Item
Android Volley - Basicnetwork.Performrequest: Unexpected Response Code 400
Could Not Resolve All Dependencies for Configuration ':Classpath'
Illegalstateexception: Link Does Not Have a Navcontroller Set
Send Post Request With Json Data Using Volley
Difference Between Add(), Replace(), and Addtobackstack()
How to Detect When the App Goes to Minimized or Exit
Could Not Connect to React Native Development Server on Android
How to Set Onclicklistener on Recyclerview Item in a Fragment
App Crashes When Running Maps Activity
How to Customize Chart Labels for Mpandroidchart Library
How to Use Sharedpreferences in Android to Store, Fetch and Edit Values