Screenshot preventing on mobile apps

Michał Międlarz
Jan 8, 2019 · 4 min read
Image for post
Image for post
Photo by Branden Tate

Android

package com.nomtek.screenshieldimport android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.WindowManager
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
}
}
Image for post
Image for post
Starting from the left: demo app, screenshot taking result, video capture result.

iOS

class ViewController: UIViewController {  override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(
forName: UIApplication.userDidTakeScreenshotNotification,
object: nil, queue: nil) { _ in
print("I see what you did there")
}
}
}

ScreenShieldKit

Image for post
Image for post
Starting from the left: demo app, screenshot taking result, video capture result. A label on top and QR code are protected by ScreenShieldKit.

Blur-obfuscating way

Conclusion

nomtek

www.nomtek.com

Michał Międlarz

Written by

I do apps… and other stuff too. iOS developer at nomtek.com

nomtek

nomtek

www.nomtek.com Nomtek is an app design and development agency founded in 2009 with offices in US, UK, Germany, Poland.

Michał Międlarz

Written by

I do apps… and other stuff too. iOS developer at nomtek.com

nomtek

nomtek

www.nomtek.com Nomtek is an app design and development agency founded in 2009 with offices in US, UK, Germany, Poland.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store