Cordova Disable Screenshots
Allow/Disallow the creation of screenshots dinamically with JS. It will make your app gray in the recent apps view.
The documentation is basically based in examples and all can be found here in this website.
Github repositoryHow to install
Include the plugin on your project executing the following command in the CLI
cordova plugin add https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git
Remember that you need an active android platform, this plugin only is available on android. Then in your document a global variable will be accesible with OurCodeWorldpreventscreenshots
Enable
Allow the creation of screenshots
The use of the plugin is pretty simple. The enable method allow the use of screenshots. You can dinamically enable or disable the screenshots feature with javascript easily.
// Pretty simple :)
var success = function(){
// Do something on success
};
var error = function(msg){
// Do something on error
};
OurCodeWorldpreventscreenshots.enable(success,error);
// Or
OurCodeWorldpreventscreenshots.enable(function(s){
console.info("The screenshots are ALLOWED again >:( ");
},function(e){
// Oops ...
console.error(e);
});
We need to execute this code in (or after) the deviceready event.
Disable
Disallow the creation of screenshots
This is the method that you need if you're looking for the plugin. Prevent that the users takes a screenshot on your app.
The disable method disallow the use of screenshots. You can dinamically enable or disable the screenshots feature with javascript easily.
// Pretty simple :)
var success = function(){
// Do something on success
};
var error = function(msg){
// Do something on error
};
OurCodeWorldpreventscreenshots.disable(success,error);
// Or
OurCodeWorldpreventscreenshots.disable(function(s){
console.info("The screenshots are NOT allowed anymore :) ");
},function(e){
// Oops ...
console.error(e);
});
We need to execute this code in (or after) the deviceready event.
On the multiview menu, the app will have a gray background and if you try to take a screenshot while is disabled a message will appear.


Trending tops in Our Code World
Top 7 : Best free web development IDE for JavaScript, HTML and CSS
See the review from 7 of the best free IDE (and code editors) for web proyects development in Our Code World.
Read articleTop 5 : Best jQuery scheduler and events calendar for web applications
See the review from 5 of the best dynamics scheduler and events calendar for Web applications with Javascript and jQuery in Our Code World
Read articleTop 20: Best free bootstrap admin templates
See the collection from 20 of the most imponent Admin templates built in bootstrap for free in Our Code World.
Read article