Detecting screenshot attempts on Android 4.0+

I am developing an Android application that puts high priority on protecting user data, to the point that they do not store anything in read-only memory on the local device.

To further protect user data, we want to make a web service call to our server whenever someone tries to take a screenshot of the active application.

The solutions I've seen so far include this snippet , designed to prevent taking a screenshot and throwing a screenshot error message in Toast to the user. Another approach I considered was to listen to the combination of the Volume Down and Power buttons that some devices use for screenshots (although devices like Samsung S4 deviate from this method). My last resort was going to use FileObserver at the location of the screen gallery for changes while the application was running, but it also seems to be a suboptimal solution and introduces a permission request that I would rather not have. I also cannot be sure of the purpose of the file for the images.

I believe the Snapchat app can alert participants when a remote user tries to take a screenshot. Do you have any suggestions on how this function can be implemented, except for rooting the device? Informal methods are also welcome.

+7
android security screenshot
source share
1 answer

FLAG_SECURE is probably the best way to avoid screenshots in the window, but as some commentators say, there are some workarounds here.

Perhaps this answer solves the question of how they do it in Snapchat to determine when a screenshot was taken.

0
source share

All Articles