Arun
Arun

Reputation: 231

Closing chrome custom tab

In my use case, I have a page that deep links back to my app. When I open this page in Chrome custom tab, I am able to get back to my app by clicking the deep link but the issue is when I click on the device back button, the chrome tab is still visible.

Is there any way I can close the chrome custom tab when the user is back to my app/activity.

Upvotes: 9

Views: 6681

Answers (2)

Paula Kristin
Paula Kristin

Reputation: 863

As @Jaspinder Kaur mentioned: you need to add this on your flag:

mCustomTabsIntent = new CustomTabsIntent.Builder().build(); 
mCustomTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HI‌​STORY)

AND:

If you set your app to be singleInstance or singleTop, then when you go back to it using an intent, the framework will finish Custom tab activity as well.

Upvotes: 4

Arun
Arun

Reputation: 231

Setting the below flag while opening chrome custom tab seems to resolve the issue for me http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY

Upvotes: 14

Related Questions