Skip to content

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

License

Notifications You must be signed in to change notification settings

ionic-team/capacitor-privacy-screen

Repository files navigation

@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

Param Type Description
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

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

About

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

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published