Skip to content

Files

Latest commit

 Cannot retrieve latest commit at this time.

History

History
88 lines (53 loc) · 2.78 KB

README.md

File metadata and controls

88 lines (53 loc) · 2.78 KB

@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; privacyModeOnActivityHidden?: 'none' | 'dim' | 'splash'; }
ios { blurEffect?: 'none' | 'light' | 'dark'; }