Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Blocking Screenshots and Screen Recording #235

Open
chaitanya-vanapamala opened this issue Jul 16, 2019 · 3 comments
Open

Blocking Screenshots and Screen Recording #235

chaitanya-vanapamala opened this issue Jul 16, 2019 · 3 comments

Comments

@chaitanya-vanapamala
Copy link

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
Copy link
Contributor

@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
Copy link

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
Copy link
Contributor

pedrovgs commented Nov 8, 2019

Nice workaround @Fanxxxx!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants