Android Question DRM against Screenshot?


Licensed User
Longtime User
There is an app that I use to control the thermostat in my home. It's called "TCC" (Total Connect Comfort) from Honeywell (a worldwide and well known heating/cooling company) in the playstore.

The first strange thing about this app is that it pops up a warning saying "the OS of this phone has been modified", which is probably detecting that my phone is rooted.

If that isn't strange enough (why a thermostat app would need to report if the device is rooted or not), I wanted to take a screen shot of the main screen of the app using the built-in screen shot feature of my phone (from the pop-up menu when I hold down the power button on my Samsung phone). But when I tried to do this, a toast message popped up and said "Unable to capture screen. DRM protected image" (that's the exact word by word message).


Putting aside the head-scratching of why on earth would a simple wifi thermostat app want to protect itself against screenshots, I was curious how could I write an app to have this same protection.

So, does anyone know how to prevent screen shots like this in an app?
Last edited:


Licensed User
Longtime User
Excellent, yes - just adding this code in the Activity_Create sub of an Activity prevents screenshots of that particular activity:

#If Java
import android.annotation.TargetApi;
import android.content.Context;
import android.view.WindowManager.*;
public void _onCreate() {
    this.getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
#End If
Upvote 0