a screenshot and screenrecord detector for react native
npm install @yplabs-ltd/react-native-detectora simply and easy to use screenshot detector for react native.
yarn
``sh`
yarn add @yplabs-ltd/react-native-detector
npm
`sh`
npm install @yplabs-ltd/react-native-detector
`sh`
cd ios && pod install
for Android you need to have access for READ_EXTERNAL_STORAGE to detect screenshots by user to do that you just need to add this line in AndroidManifest.xml
`xml`
and get user permission
`js
import { PermissionsAndroid } from 'react-native';
//...
const requestPermission = async () => {
await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
{
title: 'Get Read External Storage Access',
message: 'get read external storage access for detecting screenshots',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
}
);
};
`
`js
import {
addScreenshotListener,
addScreenrecordListener,
} from '@yplabs-ltd/react-native-detector';
// ...
React.useEffect(() => {
const userDidScreenshot = () => {
console.log('User took screenshot');
};
const unsubscribe = addScreenshotListener(userDidScreenshot);
return () => {
unsubscribe();
};
}, []);
``
| Status | Goal |
| :---------------------------------------------------: | :------------------------------------- |
| ✅ | iOS version of screenshot detector |
| ✅ (Thanks to @mhssn95) | Android version of screenshot detector |
| ✅ | IOS Screen recording detecting |
| ✅ | Android Screen recording detecting |
| 🚧 | Calls detector |
Based on the project react-native-detector to develop more.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT