How do we prevent a user from taking screenshot ?

Replies

I would be surprised if you can disable it. Snapchat requires that you be touching the screen to display the image - that prevents screenshots. Another thing you might be able to do is display the screen in quick shots of partial images, perhaps interleaving the image in some way. That way a screenshot doesn't capture the entire image.

How do you stop someone from pressing the hardware key combination? - you can't let alone enabling screen recording.

Hello,


I know this is an old post but the question is still there.


If avoiding the user taking a screenshot is not allowed and there's no way to disable that feature, is there any way or workaround that allows to show a security view if the user takes a screenshot in that image? I mean the screenshot shows the security view instead of the original data.


Regards.

Even though you succeeded doing so, how would you avoid user to snap a picture with a camera ? That would end with very similar result.


So, I fear you are chasing a ghost.

The Confide app does this and they also have an sdk (ScreenShieldKit) for third party developers. If it was done once we should also be able to detect the screenshots.

Not going in details but just giving some pointers..we can detect when a screenshot is taken sign the below code. Once the detection is done..we can either delete the last image in Potos or edit to obscure the content.


Objective C


NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];

[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationUserDidTakeScreenshotNotification

object:nil

queue:mainQueue

usingBlock:^(NSNotification *note) {

// executes after screenshot/

//Write code here to delete/obscure the last image from photos

}];

Swift

NotificationCenter.default.addObserver(

forName: UIApplication.userDidTakeScreenshotNotification,

object: nil,

queue: .main) { notification in

// executes after screenshot

//Write code here to delete/obscure the last image from photos


}

@kanishka_408

hi could you provide the swift code more in detail? it would be very appreciate