Getting Started
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-privacy-screen`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/privacy-screen/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
安装您可以使用我们的AI辅助设置来安装插件。使用以下命令将Capgo技能添加到您的AI工具中:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-privacy-screen` plugin in my project.如果您更喜欢手动设置,请运行以下命令并按照以下平台特定的说明进行安装:
-
安装插件
终端窗口 bun add @capgo/capacitor-privacy-screen -
同步本机平台
终端窗口 bunx cap sync -
查看平台行为
默认行为
标题为“默认行为”的部分插件在原生实现加载时自动启用隐私保护
- On Android,安全模式阻止截屏、屏幕录制捕获和最近应用预览。
- On iOS,插件在应用切换器快照生成期间隐藏您的应用。
- On Web,插件仅在API对齐时为内存启用标志。
基本使用
标题:基本使用import { PrivacyScreen } from '@capgo/capacitor-privacy-screen';
await PrivacyScreen.disable();
// Run a flow where screenshots or previews are temporarily allowed.
await PrivacyScreen.enable();
const { enabled } = await PrivacyScreen.isEnabled();console.log('Privacy screen enabled:', enabled);何时临时禁用它
标题:何时临时禁用它使用 disable() 仅在当前屏幕应在系统预览中保持可见或由用户捕获时使用,例如:
- 需要截屏支持的账户验证步骤
- 需要可见应用切换器预览的支付或身份提供者流程
- 在受信任的设备上进行控制的调试会话
立即之后恢复保护 enable().
继续从 Getting Started
继续从 Getting Started如果您正在使用 Getting Started 来规划安全性和合规性,连接它到 使用 @capgo/capacitor-privacy-screen 为 @capgo/capacitor-privacy-screen 原生能力 加密 为加密实现细节 合规性 关于 Compliance 的实现细节 Capgo 安全扫描器 关于 Capgo 安全扫描器的产品工作流程,以及 Capgo 安全 关于 Capgo 安全的产品工作流程