Block and Unblock Screenshots
You can also use the Xamarin SDK to block screenshots from being taken during the execution of a code block. This just temporarily blocks screenshots from being taken until you unblock screenshots. This enables you to stop taking screenshots in situations where users are entering personal data, such as on login and account screens.
The Instrumentation class provides the methods blockScreenshots() and unblockScreenshots() to block and unblock screenshots.
ScreenshotsEnabled of the IAgentConfiguration object or through the Controller UI, these methods have no effect. You can also check the Instrumentation.ScreenshotsBlocked property to check if screenshots are being blocked.
public void LoginUser()
{
if (!Instrumentation.ScreenshotsBlocked)
{
Instrumentation.BlockScreenshots();
}
LoginCredentials credentials = UserLogin.GetCredentials();
if (credentials.Authorized)
{
RedirectToProfile(credentials.user);
Instrumentation.UnblockScreenshots();
}
}