This is my use case. I have to deep link into an activity that has a fragment associated with it. This deep link requires that we sign in to the app. This is my deep link flow
Deep Link Handler Activity -> (Sign In) -> (Preference Activity).
If you were to navigate to the destination activity after logging in, which loads the main screen, then the navigation path would be
(Main Activity) - > Activity A -> (Preference Activity)
The SignIn Activity calls the destination activity, and calls finish()
thereby removing itself from the back stack. This is a legacy code, and can not be changed.
What I want to do is the following
After the destination activity is loaded after deeplink -> sign in, and if the user were to press the back button the first time, then I would like to load Activity A
followed by Home Screen
on another back button press.
Is there a way to achieve this? I have gone through the following tutorials
android activity back stack (This is the default behaviour).
My intent launch activity in the deep link handler activity.
Intent processorIntent = new Intent(this, PreferencesActivity.class);
processorIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
processorIntent.putExtra(PARAM_PREFERENCE, preference);
processorIntent.putExtra(PARAM_FLOW, true);
startActivity(processorIntent);