我的应用程序只有两个目的地,FirstFragment和SecondFragment。我为SecondFragment创建了一个 url 深层链接,它工作正常。
我想要的是,在我从 Deep Link 进入SecondFragment后,当我按下 Back 按钮时,我想回到上一个应用程序。但现在它总是回到FirstFragment。
我已将MainActivity设置为singleTask
onlaunchMode
并尝试了以下操作但不起作用:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent!!.flags = Intent.FLAG_ACTIVITY_NEW_TASK
navController.handleDeepLink(intent)
Log.v("MainActivity", "onNewIntent() get called!")
}