How to implement secure window flag on my React Native application? My focus is in the android which is coded in Kotlin

44 Views Asked by At

I've been trying to implement window security flags in my React Native Android application coded in Kotlin. My goal is to prevent the app's content from being captured via screenshots. Here's the code snippet I've tried so far:

override fun onCreate() {
    super.onCreate()
    SoLoader.init(this, false)
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
        // If you opted-in for the New Architecture, we load the native entry point for this app.
        load()
    }

    ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)

    // Window Secure Configuration
    window.setFlags(
        WindowManager.LayoutParams.FLAG_SECURE,
        WindowManager.LayoutParams.FLAG_SECURE
    )
}
0

There are 0 best solutions below