JohnC Expert Licensed User Longtime User Jan 21, 2019 #1 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). Wow!? 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: Jan 21, 2019
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). Wow!? 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?
moster67 Expert Licensed User Longtime User Jan 21, 2019 #2 This might work: https://www.b4x.com/android/forum/threads/how-to-block-ban-screen-shots-of-app.52075/#post-326475 Upvote 0
This might work: https://www.b4x.com/android/forum/threads/how-to-block-ban-screen-shots-of-app.52075/#post-326475
JohnC Expert Licensed User Longtime User Jan 21, 2019 #3 Excellent, yes - just adding this code in the Activity_Create sub of an Activity prevents screenshots of that particular activity: Code: #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
Excellent, yes - just adding this code in the Activity_Create sub of an Activity prevents screenshots of that particular activity: Code: #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