2

I want my Xamarin Forms application to disable screenshots. Is there a way to do so? Note: I found solutions in pure Android and iOS versions, but I need Xamarin solution. If there is a way to embed pure Android and iOS solution in someway, I also accept that. Thanks :)

Emrah Akgül
  • 602
  • 2
  • 6
  • 17

2 Answers2

2

There is no 100% effective way to block user from taking screenshot/record.

You have some things you can do but none of them gives you the guarantee that the user didn't do that.

I will always need to implement this specific in Android and iOS.

See this and this for android. See this and this for iOs

Community
  • 1
  • 1
jzeferino
  • 7,430
  • 1
  • 33
  • 57
0

You can disable screenshots adding this line on MainActivity.cs (Xamarin):

protected override void OnCreate(Bundle savedInstanceState)
{
   ...
   ...
   Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
}
AlejandroAlis
  • 161
  • 2
  • 9