Disable Screen Capture Permission! (Media Projection API)

I want to disable the specific permission ( Screen Capture / Screenshot ) from android Media Projection API (like Netflix). I could not find it from Andriod.Permission. Do I need to define it in manifest or is there any other work around?

And I also want to disable the screen capture just on certain scenes? Is that possible? or not disabling for the whole game is also enough.

You’ll have a lot more luck probably googling for this on the Android developer pages. There won’t be any direct exposure of this in Unity, but you may be able to use some of the UnityEngine.Android namespace of functions to implement it yourself.

What I think is I need to modify the manifest file manually. Let me research more and will update it.

Most likely it is a variation of this.

Once you figure out what it is, you can make an Android-specific editor post-build step to always do it.

Here is a bunch of interesting information regarding manipulating the AndroidManifest.xml file via Unity:

https://docs.unity3d.com/Manual/android-manifest.html

1 Like

Hi there! Are there any updates on disabling the screen capture on Android applications?

You can secure screen capturing functionality by adding FLAG_SECURE into your Activity as follows

getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); ```

source :https://stackoverflow.com/questions/30617750/prevent-other-applications-form-capturing-recording-screen/30618030#30618030

Now you will ask me : how to setFlags from Unity ? You need to call the android functions from Unity.
To do that here are some documentations :
https://medium.com/android-news/unity-and-android-connecting-the-dots-6368b31e86c5
https://docs.unity3d.com/Manual/PluginsForAndroid.html