Enable Capturing Screenshots (Android & iOS)


In some applications, we can not take a screenshot as the developer will secure the screen. While testing your application in Testsigma, it is important to enable capturing screenshots.

This article discusses how to enable capturing screenshots for Android and iOS.

NOTE:

By default, screenshots will be allowed in both Android and iOS. If for some reason the developer has disabled it in MainActivity or any other Activity you want to inspect inside the app then you have to enable it by removing the code which adds the restriction.


For Android Applications

You can enable capturing screenshots by simply removing the code below in the MainActivity.java or any other Activity you want to inspect.

getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);

Find the complete code for the MainActivity.java file below.

MainActivity Code


For iOS Applications

In iOS applications, if you’re using third party tools to disable screenshot, you need to remove that restriction to allow inspection in Testsigma.