Screenshot Capture Configuration

Screenshot capture behavior in the Discover Android SDK is controlled through the DiscoverLayoutConfig.json configuration file. This allows centralized management of screenshot enablement and masking behavior without requiring code changes.

Global Screenshot Enablement

To enable screenshot capture globally across the application, navigte to assets/DiscoverLayoutConfig.json configuration file and configure the following setting:

"HCLGlobalScreenSettings": {
    "takeScreenShot": true
}

When set to true, screenshots are captured for all eligible screens. When set to false, screenshot capture is disabled globally.

Global Screenshot Blur

To apply a uniform blur value to all screenshots across the application, navigte to assets/DiscoverLayoutConfig.json configuration file and configure the following setting:

"HCLGlobalScreenSettings": {
    "takeScreenShot": true,
    "screenShotBlur": 5
}

The specified screenShotBlur value is applied consistently to every captured screenshot. This approach is suitable for enforcing a standard privacy masking policy across all screens.

Screen-specific Blur Configuration

To apply different blur values for specific screens, use a combination of global configuration and Activity-level overrides.

  1. Set Global Configuration
    "HCLGlobalScreenSettings": {
        "takeScreenShot": true,
        "screenShotBlur": 0
    }

    Enables screenshot capture globally and disables global blur, allowing per-screen customization.

  2. Apply Blur at Activity Level

    In the Activity where a custom blur value is required:

    Discover.takeScreenShot(topScroll, "Personal_onResume", 1, 8);

    Applies the specified blur value only to the current screen and overrides the global blur configuration.

Screenshots without Blur

To capture screenshots without any blur:
  • Set screenShotBlur to 0 in HCLGlobalScreenSettings.
  • Ensure takeScreenShot is set to true.
"HCLGlobalScreenSettings": {
    "takeScreenShot": true,
    "screenShotBlur": 0
}
  • No Activity-level code changes are required
  • Screenshots will be captured without masking