Is there any listener in which we can know that URL has been changed in chrome custom tabs.
String url = ¨https://paul.kinlan.me/¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
I am opening this link using chrome custom tabs. I have to snip each url change and open appropriate activity in android
Unfortunately, it is not possible
In order to safeguard the user's privacy when navigating, the URLs are not automatically sent to the host app through the navigation events.
It is possible to get the URL as a result of the user clicking on the custom action button or on one of the buttons on the secondary toolbar.
This piece of code shows how to setup the custom action button and this code shows how to retrieve the URL inside a BroadcastReceiver, invoked by the CustomAction.
If you know the host you can setup an IntentFilter
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="paul.kinlan.me"
android:scheme="https"/>
</intent-filter>
for any Activity
you want to handle this URL in. It will start in onCreate
with an argument arguments?.get("_uri") as? Uri
or something similar, which you can further parse and see where the user has gone to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With