[英]How can I know if the user took screenshot of my app?
My app represents funny sentences that my users upload, and in order to know which sentences are better I want to know if the user has taken a screenshot. 我的应用程序代表我的用户上传的有趣句子,并且为了知道哪些句子更好,我想知道用户是否截取了屏幕截图。 The only related thing I found is from Google Maps.
我找到的唯一相关内容来自谷歌地图。 Anyone know how to make a "screenshot listener" or which method it invokes?
任何人都知道如何制作“屏幕截图监听器”或它调用哪种方法? Thanks.
谢谢。
One way to do this is by creating a class which is implementing FileObserver . 一种方法是创建一个实现FileObserver的类。 Then add listener when you are loading activity ( by using onStart() activity's method) and remove listener when you are going out of your activity (by using onStop() activity's method).
然后在加载活动时添加侦听器(通过使用onStart()活动的方法)并在离开活动时删除侦听器(通过使用onStop()activity的方法)。
Once you get FileObserver event, you have to be sure that is a picture creation. 一旦你获得FileObserver事件,你必须确保这是一个图片创建。
Note that this method is not 100% safe but it's simple to make it works ! 请注意,此方法不是100%安全,但它很容易使它工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.