title: Detect screenshot attempts on Android 4.0+
body: <p>I am developing an Android application that places a high priority on protecting the user's data, to the point of storing nothing in persistent memory on the local device.</p>
  
  <p>To further protect user data, we want to make a web-service call to our server whenever someone attempts to take a screenshot of the active application.</p>
  
  <p>Solutions that I have seen so far include <a href="http://commonsware.com/blog/2012/01/16/secure-against-screenshots.html" rel="nofollow noreferrer">this snippet</a> intended to prevent the screenshot from being taken and throwing a screenshot failure message in a Toast at the user. Another approach I was considering was listening for the combination of Volume Down and Power button that some devices use to take screenshots (though devices such as the Samsung S4 deviate from this method). My last resort was going to use a <a href="https://stackoverflow.com/questions/14951390/detection-of-screenshot-taken">FileObserver in the location of the screenshot Gallery</a> for changes while the app is running, but that also seems like a sub-optimal solution and introduces a Permission request that I'd rather not have. I also can't be sure of the file destination for the images.</p>
  
  <p>I believe the Snapchat app is able to alert participants when a remote user attempts to take a screenshot. Do you have any suggestions on how this feature might be implemented, short of rooting the device? Non-official methods are welcome as well.</p>