Monday 26 December 2022

Android 13 - TileService for Quick Settings Panel is not collapsing onClick

Short Question: startActivityAndCollapse not working for Android 13

Long Question: I am creating a tile for the quick settings panel. I have tried to implement this demo. It's working fine for all other devices except Android 13

override fun onClick() {
    super.onClick()
    try {
        val newIntent =
            FlutterActivity.withNewEngine().dartEntrypointArgs(listOf("launchFromQuickTile"))
                .build(this)
        newIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
        startActivityAndCollapse(newIntent)
    } catch (e: Exception) {
        Log.d("debug", "Exception ${e.toString()}")
    }
}

The above code is working to open the application but it's not collapsing the quick settings panel.

Is there any solution, any help?

Edited:

I had taken a look more into this and found that It's working only If I pass the Android activity.

Example (Android):

val newIntent = Intent(this, MainActivity::class.java)
newIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivityAndCollapse(newIntent)

Example (Flutter):

val newIntent = FlutterActivity.withNewEngine().dartEntrypointArgs(listOf("launchFromQuickTile")).build(this)
newIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivityAndCollapse(newIntent)

Is there any other way to open Flutter App with Params?



from Android 13 - TileService for Quick Settings Panel is not collapsing onClick

No comments:

Post a Comment