Give us feedback
preventss-oml
Mobile icon

PreventSS

Stable version 1.0.3 (Compatible with OutSystems 11)
Uploaded on 02 April 2023 by 
5.0
 (4 ratings)
preventss-oml

PreventSS

Documentation
1.0.3

cordova-plugin-prevent-screenshot-coffice

This is a cordova plugin to enable/disable screenshots in android and ios


Plugin based on https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice to Prevent users from taking ScreenShots.


Functionality to prevent the user from taking ScreenShot only works in Android.
Functionality to detect a ScreenShot taken work for both, iOS and Android.
 (see this post).

It works just in the native apps installed in devices, you will not be able to test it in Browser or PWA.


You can keep the default behavior as you want, to enable or disable it for all app, and override it for just one specific screen.

This way you may be able to either, disable this functionality to all app in an easy way or let it enabled for all app and just block in a specific screen


Github component is targetting: https://github.com/raphaelcr93/cordova-plugin-prevent-screenshot-coffice


Supported Platforms

  • Android API all versions('Detect and prevent' screenshot functionality)*
  • IOS all versions (Only 'detect screenshot' functionality)

*For android the detect functionality is based on an Observer that keeps checking if a file with name 'Screenshot' was created while the app was opened. It was taken from https://stackoverflow.com/questions/31360296/listen-for-screenshot-action-in-android And was the only option I found, personally I didn't liked

document.addEventListener("deviceready", onDeviceReady, false);
// Enable
function onDeviceReady() {
  window.plugins.preventscreenshot.enable(successCallback, errorCallback);
}
// Disable
function onDeviceReady() {
  window.plugins.preventscreenshot.disable(successCallback, errorCallback);
}

function successCallback(result) {
  console.log(result); // true - enabled, false - disabled
}

function errorCallback(error) {
  console.log(error);
}


document.addEventListener("onTookScreenshot",function(){
// Receive notification when screenshot is ready;
});

document.addEventListener("onGoingBackground",function(){
// Receive notification when control center or app going in background.
});



//Activate Detect functionality for android
function EnableDetect() {
  window.plugins.preventscreenshot.activateDetectAndroid(successActivateCallback, errorActivateCallback);
}

function successActivateCallback(result) {
  console.log(result); // true activate - enabled
}

function errorActivateCallback(error) {
  console.log(error);
}

EnableDetect();