Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 670 forks source link

Blocking Screenshots and Screen Recording #235

Open chaitanya-vanapamala opened 5 years ago

chaitanya-vanapamala commented 5 years ago

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

pedrovgs commented 5 years ago

@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.

helloxiaoyong commented 4 years ago

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) {
            }

        })
pedrovgs commented 4 years ago

Nice workaround @fanxxxx!