Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27853] Add ability to detect that screenshot was taken on iOS

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-07-30T19:30:57.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsiOS
Labelsgriffin-app, ios
ReporterBrenton House
AssigneeVijay Singh
Created2020-04-17T21:49:54.000+0000
Updated2020-07-30T19:30:57.000+0000

Description

Add ability to detect if a screenshot was taken on iOS. Probably using UIApplicationUserDidTakeScreenshotNotification

Comments

  1. Vijay Singh 2020-04-28

    I think we can create event listener 'screenshotcaptured'. e.g-
       Ti.App.iOS.addEventListener('screenshotcaptured', function() {
           Ti.API.info('screenshotcaptured');
       });
       
  2. Vijay Singh 2020-04-28

    PR - https://github.com/appcelerator/titanium_mobile/pull/11665 Test Case -
       
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       win.open();
       
       Ti.App.iOS.addEventListener('screenshotcaptured', function() {
           Ti.API.info('screenshot captured');
       });
       
  3. Michael Gangolf 2020-04-28

    perhaps something like this for Android: https://stackoverflow.com/a/29624090/5193915
  4. Joshua Quick 2020-04-29

    FYI: On Android, you can *prevent* someone from taking a screenshot of a Window by setting its "flagSecure" property to true. 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.
  5. Samir Mohammed 2020-04-29

    FR Passed, waiting on Jenkins build
  6. Christopher Williams 2020-04-30

    merged to master for 9.1.0 target
  7. Satyam Sekhri 2020-07-30

    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

JSON Source