Suppose there are 3 activities:
- MainActivity
- ActivityA
- ActivityB
The usage scenario is as follows:
-> MainActivity is opened then
-> it opens ActivityA then
-> ActivityA opens ActivityB then
-> user navigates backwards and when MainActivity is closed a notification is created for ActivityB
Now, when user clicks notification, it sends user directly to ActivityB where, if navigating backward it would go to the last opened activity before ActivityB, which in this case would be ActivityA -> MainActivity.
If MainActivity opens directly ActivityB(and navigating backwards as described above), then when notification is clicked it would send again to ActivityB but this time, when navigating backwards, the last activity before B would be MainActivity, so it should open the MainActivity and not as above(ActivityA -> MainActivity).
I would like to know what to search for and study and(eventually) how to accomplish this behaviour.
Thanks in advance.