[TIMOB-27853] Add ability to detect that screenshot was taken on iOS
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-07-30T19:30:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | iOS |
Labels | griffin-app, ios |
Reporter | Brenton House |
Assignee | Vijay Singh |
Created | 2020-04-17T21:49:54.000+0000 |
Updated | 2020-07-30T19:30:57.000+0000 |
Description
Add ability to detect if a screenshot was taken on iOS. Probably using UIApplicationUserDidTakeScreenshotNotification
I think we can create event listener 'screenshotcaptured'. e.g-
PR - https://github.com/appcelerator/titanium_mobile/pull/11665 Test Case -
perhaps something like this for Android: https://stackoverflow.com/a/29624090/5193915
FYI: On Android, you can *prevent* someone from taking a screenshot of a
Window
by setting its "flagSecure" property totrue
. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-property-flagSecure There is no official API on Google's end that can detect when a screenshot is taken though. You can only "guess" at it. Such as watching a directory where the screenshot file might go like Michael mentioned. But this is not a full-proof solution. Flagging the window that prevents the screenshot is the way to go if this is the behavior you're after.FR Passed, waiting on Jenkins build
merged to master for 9.1.0 target
Verified on: Mac OS: 10.15.4 SDK: 9.1.0.v20200727104531 Appc CLI: 8.1.0-master.7 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Xcode: 12.0 beta Device: iPhone X(v13.4), iPhone 7Plus(v12.4.5), iOS simulator 14.0 beta, 13.5