My app has just two destinations, FirstFragment and SecondFragment. I created an url Deep Link for the SecondFragment and it works fine.
What I want is, after I enter the SecondFragment from the Deep Link, I want to go back to the previous app when I press the Back button. But now it always go back to the FirstFragment.
I have set my MainActivity to singleTask
on launchMode
and tried the following but doesn't work:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent!!.flags = Intent.FLAG_ACTIVITY_NEW_TASK
navController.handleDeepLink(intent)
Log.v("MainActivity", "onNewIntent() get called!")
}