androideventsscreenshotdetect

Detect a screenshot Android


I program in recent years to Android and I wonder something : How to detect when user take a screenshot ? I want that when the user takes a screenshot , we move to the next activity . I tried the method of intercepting an event but there is a problem : when the device goes into sleep , for example, an event is intercepted . Do you have a solution for intercepts only the event of screenshot or ignore other event?

Thank you for your help !


Solution

  • There is no direct Broadcast Intent to tell you that a screenshot has been taken. Some people here discuss possible options to do so ( like it's done on Snapchat ). One possible option would be to use FileObserver.