Disabling screen shot capture in Android application

person Vinothkumar Arputharajfolder_openAndroidaccess_time June 18, 2015

In this tutorial we are going to show how to protect your application from screen shot capturing. Some applications might be having sensitive personal data (for example all banking applications), so as a developer we need to disable the option to take screen shot using DDMS console.

See following steps :

  1. Use WindowManager.LayoutParams.FLAG_SECURE before setContentView() mehtod

Note: There is no application level protection. You have to add this code in all the activities that you want to protect.

Generally, when you take a screenshot, you will see a “Screen Capture” notification in the notification bar and you can see that screenshot in the Gallery app if you click that notification. Now, if you use FLAG_SECURE, the Notification will be “Can’t take screenshot…….”.

1. Main Activity code

package com.stackandroid.disablescreenshot;
import android.app.Activity;
import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends Activity {
	public void onCreate(Bundle bundle) {

2. Demonstration

Device shortcut for taking screenshot will not work.

Screen capture using device shortcut is disabled
Screen capture using device shortcut is disabled

You cannot capture screen using DDMS console.

DDMS Screen capture disabled
DDMS Screen capture disabled


  1. Super. ts working fine

  2. How to implement this code in WallpaperService class? I want to disable recording when the system screen shows the live wallpaper from my application.

Leave a Reply to Praneet Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">