When I open my application from the link if it is on stack already (opened) nothing happens. The existing instance of the app is opened, without any redirections. I found that the reason for this one intent is called. So, I added setIntent(newIntent) inside onNewIntent method, but it did not help. Then I added the following code:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
//did not help
//setIntent(intent)
findNavController(R.id.container).handleDeepLink(intent)
}
But, then onNewIntent is called twice. The log result after the click on the link is: (when there exists the app instance)
2019-11-19 10:43:18.758 D/CORN_DEBUG: onNewIntent
2019-11-19 10:43:18.805 D/CORN_DEBUG: onNewIntent
2019-11-19 10:43:19.248 D/CORN_DEBUG: onCreate Main Activity
Otherwise, the result is:
2019-11-19 10:45:05.272 D/CORN_DEBUG: onCreate Main Activity
2019-11-19 10:45:05.524 D/CORN_DEBUG: onNewIntent
2019-11-19 10:45:06.041 D/CORN_DEBUG: onCreate Main Activity
As onCreate is called twice, the screen flickers. What is the problem?
P.S. launch mode is single task.