prongbang/screen_protector

Why is the additional snippet for Android 12+ required?

Closed this issue · 1 comments

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.

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. :)