Skip to content

Instantly share code, notes, and snippets.

@TBertuzzi
Last active July 5, 2021 17:17
Show Gist options
  • Save TBertuzzi/1609de7a399041d009d17de3659e7574 to your computer and use it in GitHub Desktop.
Save TBertuzzi/1609de7a399041d009d17de3659e7574 to your computer and use it in GitHub Desktop.
Segurança Xamarin
public partial class AppDelegate : UIApplicationDelegate
{
NSObject _screenshotNotification = null;
public override void OnActivated (UIApplication application)
{
// Inicia a verificação
if (_screenshotNotification == null)
{
_screenshotNotification = UIApplication.Notifications.ObserveUserDidTakeScreenshot((sender, args) =>
{
Console.WriteLine("Usuario tirou foto");
Console.WriteLine("Notification: {0}", args.Notification);
});
}
}
public override void OnResignActivation (UIApplication application)
{
// Para a notificação
if (_screenshotNotification != null)
{
_screenshotNotification.Dispose();
_screenshotNotification = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment