chrome-custom-tabs

How to get Url change from CustomTabsClient

99封情书 提交于 2019-11-30 20:15:35
How to get the url when the page changes, using CustomTabsClient ? For example WebView has a method: @Override public void onPageStarted(WebView view, String url, Bitmap favicon){} I need a similar method for CustomTabs . I have found this one: mClient.newSession(new CustomTabsCallback(){ @Override public void onNavigationEvent(int navigationEvent, Bundle extras) { super.onNavigationEvent(navigationEvent, extras); } @Override public void extraCallback(String callbackName, Bundle args) { super.extraCallback(callbackName, args); } }); But I am not sure if this is the one I need. How to get the

How can I check whether Chrome supports Chrome custom tabs?

依然范特西╮ 提交于 2019-11-30 13:31:11
I have an activity that loads an external url into a webview within my app. I'd like to use Chrome Custom tabs when it's available but I support devices that might not have a version of Chrome that supports them. In the case of CustomTabs not being supported I'd like to use my old code but use the CustomTabsIntent.Builder() when they are. The old code loads the content in a WebView contained in an Activity where I can still manage the ActionBar. I'd like to write a helper method that will tell me if it's supported but I'm not sure how. The info on the developer page is pretty slim: https:/

setCloseButtonIcon() method doesn't change default Close button

老子叫甜甜 提交于 2019-11-30 11:37:34
I try to change default icon for Close Button in Chrome custom tabs (CustomTabsIntent.Builder) Simple code for testing: Bitmap closeIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); intentBuilder.setCloseButtonIcon(closeIcon); But nothing happens. Why? (Nexus 7, Marshmallow) Typically this is caused by using a bitmap that has the 'wrong' dimensions. The correct dimensions are documented here: https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent.html#KEY_ICON 来源: https://stackoverflow.com/questions/34614584/setclosebuttonicon-method-doesnt

How to get Url change from CustomTabsClient

孤人 提交于 2019-11-30 04:37:41
问题 How to get the url when the page changes, using CustomTabsClient ? For example WebView has a method: @Override public void onPageStarted(WebView view, String url, Bitmap favicon){} I need a similar method for CustomTabs . I have found this one: mClient.newSession(new CustomTabsCallback(){ @Override public void onNavigationEvent(int navigationEvent, Bundle extras) { super.onNavigationEvent(navigationEvent, extras); } @Override public void extraCallback(String callbackName, Bundle args) { super

I want to load a local html file through chrome custom tab, is that workable?

こ雲淡風輕ζ 提交于 2019-11-29 09:33:48
Currently I put my html file in assets, and I load it in WebView. Can I load it through chrome custom tab? No, it is not possible to open file:// URLs in customtabs. 来源: https://stackoverflow.com/questions/33272626/i-want-to-load-a-local-html-file-through-chrome-custom-tab-is-that-workable

custom chrome tabs asks for multiple browser to choose

妖精的绣舞 提交于 2019-11-28 23:43:05
I am trying to implement custom chrome tabs. I am using Google's default library customtabs . I referred this tutorial for implementing custom chrome tabs. now as suggested in tutorial, I did my coding something like this. mCustomTabsServiceConnection = new CustomTabsServiceConnection() { @Override public void onCustomTabsServiceConnected( ComponentName componentName, CustomTabsClient customTabsClient) { mCustomTabsClient = customTabsClient; mCustomTabsClient.warmup(0L); mCustomTabsSession = mCustomTabsClient.newSession(null); } @Override public void onServiceDisconnected(ComponentName name) {

Chrome Custom Tabs redirect to Android app will close the app

◇◆丶佛笑我妖孽 提交于 2019-11-28 12:03:44
I am trying to implement an OAuth2 flow with an Android Chrome Custom Tab but my app is always closed (no crash) when the Chrome Custom Tab is receiving the 302 with the location/scheme of my app. If I create a HTML page with ahref link and touch manually on it the Chrome Custom Tab is correctly switching to my app. Seems like when handling the server 302 redirect in the Chrome Custom Tab it will not correctly handle my custom app scheme... but why? If I try the same redirect URL in a stock browser or with a WebView everything is working too. Here is my current setup: MainActiviy.java Button

Callback on dismiss of chrome custom tabs

放肆的年华 提交于 2019-11-28 10:25:11
I have an activity 'A' and inside that activity, I have opened a chrome custom tab. Now when the user closes the chrome custom tab I want to open another activity 'B'. Is there a way to know when the chrome custom tabs has been closed. Or any other way to solve the above problem. You could keep track that Custom Tabs was opened on a boolean variable on Activity A. private boolean mCustomTabsOpened = false; public void launchCustomTabs(String url) { mCustomTabsOpened = true; new CustomTabs.Builder().build().launchUrl(this, Uri.parse(url)); } Then, use Activity A's onResume() to launch Activity

android : open chrome custom tab from fragment

余生长醉 提交于 2019-11-28 07:48:01
I have one Activity MainActivity . It contains a ViewPager hosting a fragment FragmentPlaceHolder . This fragment has a RecyclerView . Now, on a click of a particular view, say button, inside a RecyclerView item, I want to open a chrome custom tab in new Activity . Can anyone help me with this one ? I am expecting a step wise implemention of Chrome Custom tabs . Thanks. Chintan Soni So, I did it this way: First of all, add this following dependency in build.gradle(app) : compile 'com.android.support:customtabs:23.1.1' First create an activity WebviewActivity : WebViewActivity.java public class

I want to load a local html file through chrome custom tab, is that workable?

不羁的心 提交于 2019-11-28 02:59:31
问题 Currently I put my html file in assets, and I load it in WebView. Can I load it through chrome custom tab? 回答1: No, it is not possible to open file:// URLs in customtabs. 来源: https://stackoverflow.com/questions/33272626/i-want-to-load-a-local-html-file-through-chrome-custom-tab-is-that-workable