With FLAG_SECURE, screen capture is not allowed. I would like my application to be able to capture the screen, but to be blured or hidden when it goes to the background.
Would you know any way to do this? Is it possible to do it with FLAG_SECURE?
I read this topic (Android : Unable to screenshot after using method FLAG_SECURE) but nobody have any valid answer for that.
The use of FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS exclude the app to appear on recents apps, but not sure if prevent the android system to take and store the status screenshoot.
Any suggestion Thanks
On your Android phone or tablet, open the Settings app . Assist & voice input. Turn on Use screenshot.
Launch “Chrome.” Then enter “ chrome://flags ” without quotes into the address bar. On the Chrome flags screen, type “ Incognito Screenshot ” without quotes into the search box. The “Incognito Screenshot” option now appears in the results. Click on the pull-down menu underneath it, then select “Enabled.”
There is currently no way to disable this “feature”. You can install Firefox and take a screenshot in Incognito mode there, but if you are taking a screenshot in Google Chrome, you must not be using Incognito Mode to do it.
It is indeed possible.
public override fun onPause() {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
super.onPause()
}
public override fun onResume() {
super.onResume()
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
This basically sets secure flags only when the app is thrown to background and clears flags on entering to foreground, so you will be able to make screenshots. I use this code in some abstract Activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With