I have an android sample app where I want to open any URL into Chrome Custom Tab instead of WebView. I am trying from https://developer.chrome.com/multidevice/android/customtabs and able to do this.
Here I'm facing a problem and that is -
If I already logged-in into facebook from Chrome Browser, then it is also shown as logged-in when I launch facebook url into Chrome Custom Tab.
It seems like Chrome Custom Tab is using the cookies of Chrome Browser. But I want to launch any URL into Chrome Custom Tab as "non-logged-in" state regardless the login state of Chrome Browser.
The problem is that I didn't find any way to clear cookies of chrome custom tab, although previously I cleared cookies by "cookieManager.removeAllCookie()" for webview.
Is it possible to clear cookies of chrome custom tab before launch URL, can anyone please help to achieve this ?
Here is my code to lauch URL into chrome custom tab -
private void launchURL(String url) {
CustomTabsIntent.Builder builderCustomTabs = new CustomTabsIntent.Builder();
CustomTabsIntent intentCustomTabs = builderCustomTabs.build();
intentCustomTabs.intent.setPackage("com.android.chrome");
intentCustomTabs.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentCustomTabs.launchUrl(this, Uri.parse(url));
}