How to get callbacks from chrome tabs in android like webview should be doneOverrideUrlLoading, onLoadResource, onPageFinished

I am trying to replace webview with Chrome Custom Tabs in my project. To replace the webview, I need a callback in the chrome tab as shown in the android webview. So, are there any callbacks or not, and if available, what are they? Please help me ahead of time.

+3


source to share


2 answers


you can only provide the following callbacks in custom chrome tabs:

/**
* Sent when the tab has started loading a page.
*/
public static final int NAVIGATION_STARTED = 1;

/**
* Sent when the tab has finished loading a page.
*/
public static final int NAVIGATION_FINISHED = 2;

/**
* Sent when the tab couldn't finish loading due to a failure.
*/
public static final int NAVIGATION_FAILED = 3;

/**
* Sent when loading was aborted by a user action before it finishes like clicking on a link
* or refreshing the page.
*/
public static final int NAVIGATION_ABORTED = 4;

/**
* Sent when the tab becomes visible.
*/
public static final int TAB_SHOWN = 5;

/**
* Sent when the tab becomes hidden.
*/
public static final int TAB_HIDDEN = 6;

      

To attach a callback, bind to the custom tabs service as usual, and just pass your callback when you call newSession ().



More information: https://developer.android.com/reference/android/support/customtabs/CustomTabsClient.html#newSession(android.support.customtabs.CustomTabsCallback)

implementation guide: https://developer.chrome.com/multidevice/android/customtabs#implementationguide

+4


source


This is not possible in a custom Chrome tab in Android.



+2


source







All Articles