screen-shots-on-mobile_01

Hello readers,

Today i am going to show, what could happen if you take a screenshot of any app content for some user. Snapchat users get notified that this user has taken a screenshot of your post.

This is what we are going to implement.

It is not that hard as it sounds, iOS 7.0 and later gives you an observer in NSNotificationCenter named UIApplicationUserDidTakeScreenshotNotification.

Just add this observer in the view did load and you can add a selector in this to perform any other task after a screenshot is taken.

Add the following code in the ViewDidLoad of you view controller.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenshotDetected) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
-(void)anotherAlert {
    UIAlertController *alertController = [UIAlertController
                                          alertControllerWithTitle:@"Hey!"
                                          message:@"Did you smile...???"
                                          preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *okAction = [UIAlertAction
                               actionWithTitle:NSLocalizedString(@"Lets see", @"OK action")
                               style:UIAlertActionStyleDefault
                               handler:^(UIAlertAction *action)
                               {
                                   NSLog(@"OK action");
                               }];
    [alertController addAction:okAction];
    [self presentViewController:alertController animated:YES completion:nil];
}

You can perform any selector in this, i have added an alert controller, you can get the details of the user logged in, and can perform a notification.

More in this screenshot stuff, i am currently trying to take a picture from the front camera, when a screenshot is taken.

Can we detect screenshots…?

Arpit Dhamane

I am a Computer Engineer, By profession i am iOS Developer. I like to explore & learn new things, R&D in new technologies, also there is a lot of SARCASM left in me to come out...!!! Feel free to contact me for any queries, i would be more than happy to help you out. I give my job description (in Hindi) as “Han Mai Keyboard Thokta Hun”.

Category: Uncategorized
526 views