Dexter icon indicating copy to clipboard operation
Dexter copied to clipboard

Blocking Screenshots and Screen Recording

Open chaitanya-vanapamala opened this issue 5 years ago • 3 comments

Our Application need to block all the screenshots and Recording of screen. com.karumi.dexter.DexterActivity is not having FLAG_SECURE for the Screenshot protection. Shall we expect change in next version?

Version of the library

4.2.0

chaitanya-vanapamala avatar Jul 16 '19 07:07 chaitanya-vanapamala

@chaitanya-vanapamala as soon as that flag doesn't modify the observable behavior of the lib feel free to send a PR adding the flag to the activity when needed.

pedrovgs avatar Jul 16 '19 07:07 pedrovgs

Flags can be add at ActivityLifecycleCallbacks.

just registerActivityLifecycleCallbacks on application onCreate

 registerActivityLifecycleCallbacks(object:ActivityLifecycleCallbacks {
            override fun onActivityPaused(activity: Activity) {
            }

            override fun onActivityStarted(activity: Activity) {
            }

            override fun onActivityDestroyed(activity: Activity) {
            }

            override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
            }

            override fun onActivityStopped(activity: Activity) {
            }

            override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
                //add window flag
                activity.window?.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
            }

            override fun onActivityResumed(activity: Activity) {
            }

        })

helloxiaoyong avatar Oct 12 '19 13:10 helloxiaoyong

Nice workaround @fanxxxx!

pedrovgs avatar Nov 08 '19 11:11 pedrovgs