Issue
I am using navcomponent deeplink option to deeplink from a universal link to my app screen.
Step 1 : added the deeplink param in main_nav_graph file
Step 2: added to manifest file of my mainactivity
Step 3: clicked on the link on a SMS to launch the deeplink
Scenarios seen:
in my app SplashActivity is the Main Launcher . But Main Activity is where navgraph is initialised. So i added the navgraph tag for main activity in Manifest
Main Activity is added as single task.
Now when i deeplink i see :
my mainactivity is resumed 2 times ( looks like app launch then close then launch again and deeplink to the screen)
If user is not logged in, i have a condition check to stay at navigation root view. But i see that it still navigates to the deeplink screen creating abnormal scenario.
Solution
As per the Navigation 2.1.0-alpha06 release notes:
Navigation now suppresses the animation that occurs when recreating the activity when handling a deep link, fixing a visual flash. (b/130362979)
So you should upgrade to Navigation 2.1.0 (currently 2.1.0-rc01
to fix the visual glitch).
Secondly, as per the conditional navigation documentation, you should not be using the login screen as the root of your graph. Instead, every destination that requires login should redirect users to the login screen if the user is not logged in. This is precisely to avoid the case you are experiencing: you want the user to be immediately sent to the correct deep linked screen with the correct back stack.
Answered By - ianhanniballake
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.