Disable ScreenShot in iOS using Xamarin Forms

Jyothi V 1 Reputation point
2021-03-30T02:18:57.027+00:00

Hi, I have tried to disable the Screenshot capture in iOS project. Did not get any reference to disable directly. I have used the below code but not able to add the blur screen at the time of screencapture. Is there any other way to disable the screenshot in iOS 14 and above.

public override void OnResignActivation(UIApplication uiApplication)
{
base.OnResignActivation(uiApplication);

// Prevent taking snapshot
uiApplication.IgnoreSnapshotOnNextApplicationLaunch();


var bgView = new UIView(uiApplication.KeyWindow.Frame) { Tag = 42, Alpha = 0, BackgroundColor = Color.FromHex("#449CD5").ToUIColor() };

uiApplication.KeyWindow.AddSubview(bgView);
uiApplication.KeyWindow.BringSubviewToFront(bgView);


UIView.Animate(0.5, () =>
{
bgView.Alpha = 1;
});
}

public override void OnActivated(UIApplication uiApplication)
{
base.OnActivated(uiApplication);

var view = uiApplication.KeyWindow.ViewWithTag(42);


if (view != null)
{
UIView.Animate(0.5, () =>
{
view.Alpha = 0;
}, () =>
{
view.RemoveFromSuperview();
});
}
}

regards,
Jyothi.

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,756 Reputation points
    2021-03-30T08:51:13.257+00:00

    Hello,

    Welcome to Microsoft Q&A!

    It seems that this could be achieved before iOS 7, see this solution .

    However from iOS 7 there is no way to prevent user to take screen shot .

    We can only get notified after screen shot is taken , not before or while , see this comment .


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.