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.