简体   繁体   English

在 Android 和 iOS 应用程序中禁用屏幕截图功能

[英]Disable screenshot function in Android and iOS app

I'm interested in creating an access control app for a project in college.我有兴趣为大学项目创建访问控制应用程序。 The app would contain a barcode/QR code to read the person identity when placed under a scanner.该应用程序将包含一个条形码/二维码,用于在放置在扫描仪下时读取个人身份。

To limit unauthorised persons from obtaining access to the barcode used for entry I was hoping to disable a person from taking a screenshot whilst in the app.为了限制未经授权的人访问用于进入的条形码,我希望禁止一个人在应用程序中截取屏幕截图。 Is this feature possible?这个功能可以吗?

Thanks in advance!提前致谢!

Dear friend you have to do some tricky thing for this thing as you can't actually prevent user to take screenshot or getting the picture from another mobile,亲爱的朋友,您必须为此做一些棘手的事情,因为您实际上无法阻止用户截屏或从其他手机获取图片,

so this thing is not gonna solve only by mobile side.所以这件事不能只靠移动端解决。

So whats the best approch for this?那么什么是最好的方法呢?

According to me you should handle this thing with the help of server side communication store the expiry seconds in QR code data set like:根据我的说法,您应该借助服务器端通信来处理这件事,将过期秒数存储在二维码数据集中,例如:

{
  "id" : "some-user-id",
  "ency-key" : "your-latest-key",
  "expiry" : "60"
}

here your ency-key will be your latest encription key that you will get from server by using webservice or something like that.在这里,您的ency-key将是您将通过使用 webservice 或类似的东西从服务器获取的最新加密密钥。 Now the tricky thing is that this key is only valied for 60 seconds (OR as per your requirement) after getting this key from server, server should refresh the key so if the unauthorized user will try to access the same code by storing in screenshot or photo, he/she will not be able to access the system.现在棘手的是,在从服务器获取此密钥后,此密钥仅在 60 秒内有效(或根据您的要求),服务器应刷新密钥,以便未经授权的用户尝试通过存储在屏幕截图或照片,他/她将无法访问系统。

Thats from my side :) hope this thing may help you那是我这边的 :) 希望这件事可以帮助你

Answer for iOS: You can't actually prevent user to take screenshot, however you can find if user have just taken screenshot by observing UIApplicationUserDidTakeScreenshotNotification notification and then you can either delete such photo from gallery(if permission have been given) though this is not good at all or you can blur the image. iOS 的答案:您实际上can't阻止用户截屏,但是您可以通过观察UIApplicationUserDidTakeScreenshotNotification通知来确定用户是否刚刚截屏,然后您可以从图库中删除此类照片(如果已获得许可),尽管这不是很好,或者你可以模糊图像。 but my point here is, even if you, somehow manage to prevent screenshot, how you gonna prevent user to take photo from other device?但我的意思是,即使您以某种方式设法阻止屏幕截图,您将如何阻止用户从其他设备拍照?

PS.附注。 I am not sure if its possible in android or not.我不确定在 android 中是否可能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM