Resume browsing on Chrome Custom Tab

426 Views Asked by At

I am working on an special oauth flow on Android. I have an activity A which can delegate the authentication to a webpage using a CustomTabIntent launched by UI-less Activity B. Once the authentication finishes it redirects with a deep link that B intercepts and closes the activities clearing the backstack which looks like

A -> B -> CustomTab

So when it finishes B with FLAG_ACTIVITY_CLEAR_TOP it goes back to A

Now for a new feature the difference is that the deep link intercepted by B needs to open C to do some permission management. I am able to do that by just finishing B and launching C. However once C finishes I need to take my user back to the browser to finish the authentication so I need a backstack that looks like

A -> B -> CustomTab ->C

But I seem unable to launch C on top of CustomTab without closing the later. Closing it is not an option since I need my user to continue at the point where he left the browser. Another option would be if I could close the Custom Tab but later resume the browser at the state it was closed. But I haven't been able to find a way to do neither of these.

Now to complicate the problem more, C could be a new instance of A ending with something like

A -> B -> CustomTab ->A2

Therefore launching my activities as single tasks is not an option.

If someone has been able to launch an activity on top of a custom tab without closing it I would really appreciate your help. Or if you have any other idea to tackle this problem it would be welcome.

0

There are 0 best solutions below