检测屏幕截图 Android [英] Detect a screenshot Android
问题描述
我近年来对 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?
感谢您的帮助!
推荐答案
没有直接的 Broadcast Intent 告诉您已截取屏幕截图.有些人这里讨论了可能的选项(就像在快照).一种可能的选择是使用 FileObserver
.
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
.
这篇关于检测屏幕截图 Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!