Unable to StartActivity from a class that extends Accessibility Service only in android 12

47 Views Asked by At

I have this

 private fun launchBlockingActivity(appName: String, appPackage: String?) {
        Timber.d("Inside Launch Blocked ACTIVITY")

        val blockedIntent = Intent(this@AccessibilityService, ActivityBlocked::class.java)
        blockedIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
        blockedIntent.flags = FLAG_ACTIVITY_NEW_TASK
        blockedIntent.putExtra(this.getString(R.string.appName), appName)
        blockedIntent.putExtra(this.getString(R.string.packageName), appPackage)
        applicationContext.startActivity(blockedIntent)
    }

This function is inside a class that has extended Accessibility Service. When certain condition are met this activity should launch. It launches activity on android version 11 13 10, but not in 12. Why, what could be the reason?

0

There are 0 best solutions below