How to get Url change from CustomTabsClient

How to get url when changing a page 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 found this:

 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'm not sure if this is the one I need.

+5
source share
1 answer

How to get url when changing a page using CustomTabsClient ?

Sorry, you can’t. There is also a problem with the Chromium error debugger:

https://code.google.com/p/chromium/issues/detail?id=543542

The only thing you can do now is to know when the tab started or finished loading the page, but you cannot get the URL:

 mClient.newSession(new CustomTabsCallback(){ @Override public void onNavigationEvent(int navigationEvent, Bundle extras) { Log.w(TAG, "onNavigationEvent: Code = " + navigationEvent); switch (navigationEvent) { case NAVIGATION_STARTED: // Sent when the tab has started loading a page. break; case NAVIGATION_FINISHED: // Sent when the tab has finished loading a page. break; case NAVIGATION_FAILED: // Sent when the tab couldn't finish loading due to a failure. break; case NAVIGATION_ABORTED: // Sent when loading was aborted by a user action before it finishes like clicking on a link // or refreshing the page. break; } } }); 
+11
source

Source: https://habr.com/ru/post/1234524/


All Articles