This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo ScreenCapture
A library that allows you to protect screens in your app from being captured or recorded.
expo-screen-capture allows you to protect screens in your app from being captured or recorded, as well as be notified if a screenshot is taken while your app is foregrounded. The two most common reasons you may want to prevent screen capture are:
- If a screen is displaying sensitive information (password, credit card data, and so on)
- You are displaying paid content that you don't want to be recorded and shared
This is especially important on Android since the android.media.projection API allows third-party apps to perform screen capture or screen sharing (even if the app is in the background).
On Android, the screen capture callback works without additional permissions only for Android 14+. You don't need to request or check permissions for blocking screen capture or using the callback on Android 14+.
If you want to use the screen capture callback on Android 13 or lower, you need to add the READ_MEDIA_IMAGES permission to your AndroidManifest.xml file. You can use the android.permissions key in your app config. See Android permissions for more information.
The
READ_MEDIA_IMAGESpermission can be added only for apps needing broad access to photos. See Details on Google Play's Photo and Video Permissions policy.
For testing screen capture functionality: On Android Emulator, run
adb shell input keyevent 120in a separate terminal to trigger a screenshot. On iOS Simulator, you can trigger screenshots using Device > Trigger Screenshot from the menu bar.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Example: hook
Example: Blocking screen capture imperatively
Example: Callback for screen capture
API
import * as ScreenCapture from 'expo-screen-capture';
No API data file found, sorry!