Skip to main content
Version: v7

@capacitor/privacy-screen

The Privacy Screen plugin provides functionality to prevent sensitive information from being visible in app switchers and when leaving an app.

Note: This plugin is supported on Android and iOS platforms only. It is not available for web platforms.

Installโ€‹

npm install @capacitor/privacy-screen
npx cap sync

Platform Notesโ€‹

Androidโ€‹

The privacy screen behavior on Android varies depending on the navigation method used:

  • When using gesture navigation or the recent apps button, the privacy screen will display as configured
  • When using the home button to exit the app, the system must fall back to using FLAG_SECURE as it's the only way to prevent content visibility in this scenario

APIโ€‹

enable(...)โ€‹

enable(config?: PrivacyScreenConfig | undefined) => Promise<{ success: boolean; }>

Enable privacy screen protection

ParamTypeDescription
config
PrivacyScreenConfig
Optional configuration for platform-specific behavior

Returns: Promise<{ success: boolean; }>


disable()โ€‹

disable() => Promise<{ success: boolean; }>

Disable privacy screen protection

Returns: Promise<{ success: boolean; }>


isEnabled()โ€‹

isEnabled() => Promise<{ enabled: boolean; }>

Check if privacy screen is currently enabled

Returns: Promise<{ enabled: boolean; }>


Interfacesโ€‹

PrivacyScreenConfigโ€‹

PropType
android{ dimBackground?: boolean; preventScreenshots?: boolean; }
ios{ blurEffect?: 'light' | 'dark' | 'none'; }