The Task
I am supposed to connect two application that I made in android . Lets call one of them A (with activities A1 , A2, A3) and B (activities B1 ,B2 , B3) . A user would login from Application A ,and would be redirected to Application B . In Application B , the user might hop between activities . After he is done , he would press LOGOUT from Application B , and would be redirected to Application A . Upon doing this , I want the Application B to be cleared from the backstack .
The Problem
Even though upon logout I am finishing all the activities from the stack , the application name B is still mentioned in the back stack .
What I have achieved so far
This is how I invoke the Application B from Application A
Intent intent= new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("appB", "appB.MainActivity"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(ARG_G2G_ACCESS_TOKEN, mTokenResponse.getAccessToken());
startActivity(intent);
Upon logout , this is how I call the application A again . Firstly I finish all the activities that are running in the Task . Then I do
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setComponent(new ComponentName("appA", "appA.MainActivity"));
However even with the above the Application Application B is still mentioned in the Backstack. I would like that to be removed when B is launched from A.
Thanks