Implementing screenshot protection in a mobile application

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Implementing screenshot protection in a mobile application
Medium
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing screenshot protection in mobile applications

Banking app shows balance, account number, transaction details — all can be on screenshot in gallery, read by another app or leak via cloud backup. On iOS screenshot automatically saves to Photos. On Android apps with necessary permissions can read MediaStore. Screenshot protection — standard requirement in fintech and medical apps.

Android: FLAG_SECURE

One line that works:

window.setFlags(WindowManager.LayoutParams.FLAG_SECURE,
                WindowManager.LayoutParams.FLAG_SECURE)

FLAG_SECURE does two things: forbids system tools from creating window screenshot (screenshot button doesn't work, returns blank screen) and marks surface as protected — other apps can't capture contents via MediaProjection.

Best place — onCreate Activity before setContentView. For Fragment-based app on single Activity — applies to whole app at once.

Nuance: FLAG_SECURE works for system API screenshots. Physical camera shooting screen — nothing blocks it programmatically.

iOS: UIScreen and WindowScene

iOS has no direct FLAG_SECURE equivalent. Standard approach — react to screenshot, not block it.

Screenshot detection:

NotificationCenter.default.addObserver(
    forName: UIApplication.userDidTakeScreenshotNotification,
    object: nil,
    queue: .main
) { _ in
    // log, show warning, invalidate session
}

Content blocking on screenshot. Screenshot created by system before notification reaches app — can't block after fact. Alternative: subscribe to UIScreen.capturedDidChangeNotification (triggers when screen capture begins, including AirPlay mirroring and QuickTime) and hide sensitive content proactively.

NotificationCenter.default.addObserver(
    forName: UIScreen.capturedDidChangeNotification,
    object: nil,
    queue: .main
) { [weak self] _ in
    self?.sensitiveView.isHidden = UIScreen.main.isCaptured
}

Works for screen recording and mirroring, but not screenshot button click — isCaptured doesn't become true on single shot.

Keychain and SecureTextField trick. For text fields with sensitive data — isSecureTextEntry = true. iOS automatically blurs such field contents on screenshots by Passbook/Notes system app and in task switcher.

Overlay approach. On background (sceneWillResignActive) show UIWindow with placeholder over app:

func sceneWillResignActive(_ scene: UIScene) {
    privacyWindow?.isHidden = false
}
func sceneDidBecomeActive(_ scene: UIScene) {
    privacyWindow?.isHidden = true
}

Protects preview in App Switcher — standard practice for fintech apps.

React Native and Flutter

React Native: react-native-flag-secure-android for Android, custom native module for iOS. For Flutter — flutter_windowmanager package on Android, native platform channel for iOS overlay.

Timeline for implementation: Android FLAG_SECURE + iOS overlay on background + reaction to capturedDidChangeNotification — about 1 day with testing on both platforms.