如何以编程方式检测Android中是否正在运行任何屏幕录制过程/应用程序? [英] How to programmatically detect if any screen recording process/app is running in Android?

查看:2144
本文介绍了如何以编程方式检测Android中是否正在运行任何屏幕录制过程/应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不希望用户拍摄我的应用程序的屏幕截图或记录屏幕.我已经在窗口中添加了安全标志.这样可以防止用户拍摄屏幕截图和录制屏幕.

I don't want users to take screenshot or record screen of my app. I have added secure flag to the window. This prevents user from taking screenshots and recording screen.

如果打开了屏幕录制功能,我的应用程序会阻止录制内容,但会录制音频.

If the screen recording is on, my app prevents the content from being recorded but the audio gets recorded.

在某些已root用户的设备上,安全标志可能无法按预期工作. 因此,我只想检测是否有任何屏幕录制应用程序/进程在后台运行,以便我可以隐藏敏感数据并阻止对其进行录制.

On some rooted devices, the secure flags may not work as expected. So I just want to detect if any screen recording app/process is running in background so that I can hide sensitive data and prevent it from being recorded.

有什么方法可以检测屏幕录制是否打开?

Is there any way I can detect if the screen recording is on?

推荐答案

有什么方法可以检测屏幕录制是否打开?

Is there any way I can detect if the screen recording is on?

否.

所以我只想检测是否有任何屏幕录制应用程序/进程在后台运行,以便我可以隐藏敏感数据并阻止对其进行录制.

So I just want to detect if any screen recording app/process is running in background so that I can hide sensitive data and prevent it from being recorded.

由于屏幕录制不需要录制专用的应用程序或进程(例如adb shell screenrecord),并且由于您无法了解正在使用媒体投影API的特定应用程序或进程,因此这似乎是不切实际的.而且,在现代版本的Android上,无论如何您都无法知道正在运行哪些其他进程.此外,没有什么可以阻止用户将另一个摄像机对准设备屏幕并以这种方式记录其内容.

Since screen recording does not require a recording-specific app or a process (e.g., adb shell screenrecord), and since you have no way of knowing particular apps or processes that are using the media projection API, this seems impractical. And, on modern versions of Android, you have no way of knowing what other processes are running, anyway. Plus, there is nothing stopping the user from pointing another camera at the device screen and recording its contents that way.

我不希望用户拍摄我的应用程序的屏幕截图或记录屏幕

I don't want users to take screenshot or record screen of my app

然后不编写应用程序. FLAG_SECURE背后的想法是帮助保护用户免受第三方侵害,而不是保护开发人员免受用户侵害.

Then do not write the app. The idea behind FLAG_SECURE is to help defend the user against third parties, not to defend the developer against the user.

这篇关于如何以编程方式检测Android中是否正在运行任何屏幕录制过程/应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆