prongbang / screen_protector

Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for Android and iOS.
https://pub.dev/packages/screen_protector
MIT License
39 stars 18 forks source link

Why is the additional snippet for Android 12+ required? #27

Closed TheHudek closed 8 months ago

TheHudek commented 8 months ago

The package works fine for Android 13 without the below code:

import com.prongbang.screenprotect.AndroidScreenProtector

class MainActivity : FlutterFragmentActivity() {

    private val screenProtector by lazy { AndroidScreenProtector.newInstance(this) }

    // For Android 12+
    override fun onWindowFocusChanged(hasFocus: Boolean) {
        super.onWindowFocusChanged(hasFocus)
        screenProtector.process(hasFocus.not())
    }
}

Why is it needed then? Should I add this to the MainActivity.kt regardless?

The package itself is awesome and no issues so far.

prongbang commented 8 months ago

I apologize, the document does not clearly indicate whether the "Protect Data Leakage for Android 12+" package is optional.

You can configure it if you want.

Thank you for reporting the issue. :)