Skip to content

An Open Source library to hide the screens during screenshots or recordings

License

Notifications You must be signed in to change notification settings

cesp99/ScreenShield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

ScreenShield: Comprehensive Protection for Sensitive Content

ScreenShield is a robust Kotlin library designed to safeguard your Android app's sensitive content by preventing screenshots and screen recordings. Built with Jetpack Compose, this library leverages Android's FLAG_SECURE flag to automatically protect your app's screens while they are active, ensuring that confidential information remains secure.

ScreenShield offers a seamless and efficient solution for enhancing your app's privacy. Part of the library's implementation is based on the work by @ahmetfurkhans, which inspired this effective approach.

Key Features

  • Screenshot Protection: Blocks users from taking screenshots of protected screens within your app.
  • Screen Recording Prevention: Disables screen recording while your app is in the foreground, ensuring sensitive information cannot be captured.
  • Lifecycle Integration: Automatically applies protection when your app is in use and removes it when the app goes into the background.

Installation

To integrate ScreenShield into your Jetpack Compose project, simply drag and drop ScreenShield.kt into your codebase, add import ScreenShield where you want to use it and wrap the content you wish to protect with it.

Usage

import ScreenShield

@Composable
fun YourProtectedScreen() {
    ScreenShield {
        // Your protected UI content
    }
}

By wrapping your composables with AntiSS, you ensure that screenshots and screen recordings are blocked whenever the screen is active.

How It Works

ScreenShield uses Android's WindowManager.LayoutParams.FLAG_SECURE flag to prevent screenshots and screen recordings. The library is lifecycle-aware, automatically managing protection based on the current state of the app. Whether your app is in the foreground or background, ScreenShield ensures that your content is secure.

Core Components:

  1. AntiSS Composable: The central composable that blocks screenshots and recordings.
  2. ComposableLifeCycle: A lifecycle-aware composable that triggers protection based on the app's state.
  3. findActivity(): A helper function that retrieves the current activity, essential for applying window flags.

License

This project is distributed under the MIT License. For more details, refer to the LICENSE file.

Contact

For inquiries or support, feel free to reach out to Carlo at [email protected].

Authors

Used By

This library is used currently on this apps:

About

An Open Source library to hide the screens during screenshots or recordings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages