{"id":13795148,"url":"https://github.com/capacitor-community/privacy-screen","last_synced_at":"2025-05-16T09:03:59.569Z","repository":{"id":38284571,"uuid":"330129326","full_name":"capacitor-community/privacy-screen","owner":"capacitor-community","description":"⚡️ Capacitor plugin that protects your app from displaying a screenshot in Recents screen/App Switcher.","archived":false,"fork":false,"pushed_at":"2025-01-28T21:34:00.000Z","size":797,"stargazers_count":94,"open_issues_count":11,"forks_count":26,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-07T09:44:23.449Z","etag":null,"topics":["android","capacitor","capacitor-community","capacitor-plugin","ios"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capacitor-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-16T09:40:39.000Z","updated_at":"2025-02-25T23:58:06.000Z","dependencies_parsed_at":"2024-01-02T23:09:41.639Z","dependency_job_id":"a93ab242-10bf-414d-ae0e-e6b194754f4d","html_url":"https://github.com/capacitor-community/privacy-screen","commit_stats":{"total_commits":134,"total_committers":11,"mean_commits":"12.181818181818182","dds":"0.13432835820895528","last_synced_commit":"231f7078a604ddb62b3d2f3715326a710e3cd86c"},"previous_names":["robingenz/capacitor-privacy-screen"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fprivacy-screen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fprivacy-screen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fprivacy-screen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capacitor-community%2Fprivacy-screen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capacitor-community","download_url":"https://codeload.github.com/capacitor-community/privacy-screen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101615,"owners_count":22014909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","capacitor","capacitor-community","capacitor-plugin","ios"],"created_at":"2024-08-03T23:00:52.683Z","updated_at":"2025-05-16T09:03:59.551Z","avatar_url":"https://github.com/capacitor-community.png","language":"Swift","funding_links":[],"categories":["Plugins","Swift","Community plugins"],"sub_categories":["Community Plugins"],"readme":"\u003cp align=\"center\"\u003e\u003cbr\u003e\u003cimg src=\"https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png\" width=\"128\" height=\"128\" /\u003e\u003c/p\u003e\n\u003ch3 align=\"center\"\u003ePrivacy Screen\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\u003ccode\u003e@capacitor-community/privacy-screen\u003c/code\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\nCapacitor Privacy Screen Plugin\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/maintenance/yes/2025?style=flat-square\" /\u003e\n  \u003ca href=\"https://github.com/capacitor-community/privacy-screen/actions?query=workflow%3A%22CI%22\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/capacitor-community/privacy-screen/ci.yml?branch=main\u0026style=flat-square\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@capacitor-community/privacy-screen\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@capacitor-community/privacy-screen?style=flat-square\" /\u003e\u003c/a\u003e\n\u003cbr\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@capacitor-community/privacy-screen\"\u003e\u003cimg src=\"https://img.shields.io/npm/dw/@capacitor-community/privacy-screen?style=flat-square\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@capacitor-community/privacy-screen\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@capacitor-community/privacy-screen?style=flat-square\" /\u003e\u003c/a\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n\u003ca href=\"#contributors-\"\u003e\u003cimg src=\"https://img.shields.io/badge/all%20contributors-0-orange?style=flat-square\" /\u003e\u003c/a\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\u003c/p\u003e\n\n## Introduction\n\n⚡️ [Capacitor](https://capacitorjs.com/) plugin that protects your app from displaying a screenshot in [Recents screen](https://developer.android.com/guide/components/activities/recents)/[App Switcher](https://support.apple.com/en-us/HT202070).\n\nOn **Android**, this plugin sets the [FLAG_SECURE](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_SECURE) flag to treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.  \nOn **iOS**, this plugin hides the webview window when the app is no longer active and loses focus ([UIApplicationWillResignActiveNotification](https://developer.apple.com/documentation/uikit/uiapplicationwillresignactivenotification)) so that a gray screen is shown instead. It also prevents screenshots (a black screen will be captured).\n\n### Using the Camera Plugin\n\nDisabling screenshots can interfere with plugins that hide the WebView like the Camera plugin. To avoid issues call `disable` before using a plugin and then `enable` after you are finished.\n\n## Maintainers\n\n| Maintainer | GitHub                                    | Social                                        |\n| ---------- | ----------------------------------------- | --------------------------------------------- |\n| Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |\n\n## Installation\n\n```\nnpm install @capacitor-community/privacy-screen\nnpx cap sync\n```\n\n## Configuration\n\n\u003cdocgen-config\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\nThese configuration values are available:\n\n| Prop                     | Type                                                                            | Description                                                                                                                                                 | Default               | Since |\n| ------------------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----- |\n| **`enable`**             | \u003ccode\u003eboolean\u003c/code\u003e                                                            | Configure whether the plugin should be enabled from startup. Only available for Android and iOS.                                                            | \u003ccode\u003etrue\u003c/code\u003e     |       |\n| **`imageName`**          | \u003ccode\u003estring\u003c/code\u003e                                                             | Configure whether the plugin should display a custom image from assets instead of a default background gray for the privacy screen. Only available for iOS. | \u003ccode\u003e\"\"\u003c/code\u003e       |       |\n| **`contentMode`**        | \u003ccode\u003e'center' \\| 'scaleToFill' \\| 'scaleAspectFit' \\| 'scaleAspectFill'\u003c/code\u003e | Configure the content mode of displayed image. Only available for iOS.                                                                                      | \u003ccode\u003e\"center\"\u003c/code\u003e |       |\n| **`preventScreenshots`** | \u003ccode\u003eboolean\u003c/code\u003e                                                            | Configure whether the plugin should prevent screenshots if enabled. Only available for iOS.                                                                 | \u003ccode\u003etrue\u003c/code\u003e     | 5.2.0 |\n\n### Examples\n\nIn `capacitor.config.json`:\n\n```json\n{\n  \"plugins\": {\n    \"PrivacyScreen\": {\n      \"enable\": true,\n      \"imageName\": \"Splashscreen\",\n      \"contentMode\": \"scaleAspectFit\",\n      \"preventScreenshots\": false\n    }\n  }\n}\n```\n\nIn `capacitor.config.ts`:\n\n```ts\n/// \u003creference types=\"@capacitor-community/privacy-screen\" /\u003e\n\nimport { CapacitorConfig } from '@capacitor/cli';\n\nconst config: CapacitorConfig = {\n  plugins: {\n    PrivacyScreen: {\n      enable: true,\n      imageName: \"Splashscreen\",\n      contentMode: \"scaleAspectFit\",\n      preventScreenshots: false,\n    },\n  },\n};\n\nexport default config;\n```\n\n\u003c/docgen-config\u003e\n\n## Demo\n\nA working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)\n\n## Usage\n\nThe plugin only needs to be installed. The protection is enabled by default.  \nHowever, you have the option to enable/disable the protection:\n\n```js\nimport { PrivacyScreen } from '@capacitor-community/privacy-screen';\n\nconst enable = async () =\u003e {\n  await PrivacyScreen.enable();\n};\n\nconst disable = async () =\u003e {\n  await PrivacyScreen.disable();\n};\n```\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`enable()`](#enable)\n* [`disable()`](#disable)\n* [`addListener('screenRecordingStarted', ...)`](#addlistenerscreenrecordingstarted-)\n* [`addListener('screenRecordingStopped', ...)`](#addlistenerscreenrecordingstopped-)\n* [`addListener('screenshotTaken', ...)`](#addlistenerscreenshottaken-)\n* [`removeAllListeners()`](#removealllisteners)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### enable()\n\n```typescript\nenable() =\u003e Promise\u003cvoid\u003e\n```\n\nEnables the privacy screen protection.\n\nOnly available for Android and iOS.\n\n**Since:** 1.1.0\n\n--------------------\n\n\n### disable()\n\n```typescript\ndisable() =\u003e Promise\u003cvoid\u003e\n```\n\nDisables the privacy screen protection.\n\nOnly available for Android and iOS.\n\n**Since:** 1.1.0\n\n--------------------\n\n\n### addListener('screenRecordingStarted', ...)\n\n```typescript\naddListener(eventName: 'screenRecordingStarted', listenerFunc: () =\u003e void) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nCalled when the screen recording is started.\n\nOnly available on iOS for now.\n\n| Param              | Type                                  |\n| ------------------ | ------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'screenRecordingStarted'\u003c/code\u003e |\n| **`listenerFunc`** | \u003ccode\u003e() =\u0026gt; void\u003c/code\u003e            |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 3.0.2\n\n--------------------\n\n\n### addListener('screenRecordingStopped', ...)\n\n```typescript\naddListener(eventName: 'screenRecordingStopped', listenerFunc: () =\u003e void) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nCalled when the screen recording is stopped.\n\nOnly available on iOS for now.\n\n| Param              | Type                                  |\n| ------------------ | ------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'screenRecordingStopped'\u003c/code\u003e |\n| **`listenerFunc`** | \u003ccode\u003e() =\u0026gt; void\u003c/code\u003e            |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 3.0.2\n\n--------------------\n\n\n### addListener('screenshotTaken', ...)\n\n```typescript\naddListener(eventName: 'screenshotTaken', listenerFunc: () =\u003e void) =\u003e Promise\u003cPluginListenerHandle\u003e\n```\n\nCalled when the screenshot is taken.\n\nOnly available on iOS for now.\n\n| Param              | Type                           |\n| ------------------ | ------------------------------ |\n| **`eventName`**    | \u003ccode\u003e'screenshotTaken'\u003c/code\u003e |\n| **`listenerFunc`** | \u003ccode\u003e() =\u0026gt; void\u003c/code\u003e     |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#pluginlistenerhandle\"\u003ePluginListenerHandle\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 3.2.0\n\n--------------------\n\n\n### removeAllListeners()\n\n```typescript\nremoveAllListeners() =\u003e Promise\u003cvoid\u003e\n```\n\nRemove all listeners for this plugin.\n\n**Since:** 3.0.2\n\n--------------------\n\n\n### Interfaces\n\n\n#### PluginListenerHandle\n\n| Prop         | Type                                      |\n| ------------ | ----------------------------------------- |\n| **`remove`** | \u003ccode\u003e() =\u0026gt; Promise\u0026lt;void\u0026gt;\u003c/code\u003e |\n\n\u003c/docgen-api\u003e\n\n## Changelog\n\nSee [CHANGELOG.md](https://github.com/capacitor-community/privacy-screen/blob/main/CHANGELOG.md).\n\n## License\n\nSee [LICENSE](https://github.com/capacitor-community/privacy-screen/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapacitor-community%2Fprivacy-screen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapacitor-community%2Fprivacy-screen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapacitor-community%2Fprivacy-screen/lists"}