Is there any way to prevent Tapjacking? (Flutter app)

85 views Asked by At

I am an app developer in Flutter. I have used the following code in MainActivity to prevent tapjacking.

    val view = findViewById<View>(android.R.id.content).rootView
    view.filterTouchesWhenObscured = true

Here's the problem: The dialog displayed by the flutter_inappwebivew plugin In-App Browser or Firebase In-App Messaging does not prevent tapjacking in the above way.

How can I combat this problem?

Chat GPT answers were not helpful

    val activityStartedReceiver = object : BroadcastReceiver() {
      override fun onReceive(context: Context, intent: Intent) {
        log(intent.toString())
        if (Intent.ACTION_MAIN == intent.action && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intent.flags and Intent.FLAG_ACTIVITY_NEW_TASK != 0) {
          val rootView = window?.decorView?.rootView
          rootView?.filterTouchesWhenObscured = true
        }
      }
    }
0

There are 0 answers