Some apps don't allow screenshots so how can I still take a screenshot?
It is my phone and I should be able to do whatever I want with it so why is there even a feature to disallow screenshots?
Some apps present sensitive data (e.g. banking apps) or copyright-protected content (e.g. video streaming apps). App developers can opt to use the Android platform’s
FLAG_SECURE setting to prevent the screen from being captured, recorded, or shown on “non-secure displays” such as the recent apps view. There are a couple of ways to disable this flag:
The Smali Patcher method requires you to connect your phone to a PC and run a Windows program to actually generate the module. Note that Magisk on Android 4.2 does not support MagiskHide.
The Xposed method has a big caveat: many banking apps use Google’s SafetyNet platform for checking device integrity, and prevent the application from being used on devices that have Xposed installed. This renders the module useless in SafetyNet-enabled apps, and there is currently no way to hide Xposed from SafetyNet.
Use these modules with caution, as they disable the flag system-wide.
If you can’t or don’t want to disable
FLAG_SECURE on your phone, you can also use scrcpy. It lets you mirror your phone’s display to your computer, and then you can just use a screenshot software of your choice on your computer to capture the phone’s screen. This requires you to turn on ADB debugging from your phone’s development settings, but beware that some apps restrict their functions when they detect that development settings are enabled. Scrcpy works on Android versions 5.0–12.0.
There's also Smali Patcher program for Windows which creates custom Magisk module for your device and has option to disable
Apps which are set with LayoutParams.FLAG_SECURE flag do not allow screenshots (or videos recording) to be taken. It is of-course your phone but the app belongs to its owner (and he can rightfully wish to prevent users from capturing something sensitive in nature). You're barred from taking a screenshot only for those screens that have the above flag set. However you can still take a screenshot by projecting your phone on the PC screen and capturing it. That way, the device has no idea that screenshot is taken.
I've found a workaround: from the app that is blocking screenshots press the Home button/gesture and then the Recents button/gesture so you can see the app you want to screenshot; you can then screenshot with the normal button shortcut or the on-screen "screenshot" button (and the resulting screenshot will not be blacked-out).
This worked for an over-zealous app which didn't want me screenshotting a specific screen but not for a well-made app (i.e. a browser in incognito mode), so it's almost certainly an exploit that might be patched rather than intended behaviour. Tested on android 9 and 12.
Following on from 'user's' answer, using a program such as Droid@screen droid at screen will allow you to project your phone screen to the PC, and then screenshot it via the PC Prnt Scrn button.
UPDATE: Android screen mirror is a better and faster screen mirror