简体   繁体   English

如何在Chrome自定义标签中收听网址更改

[英]How do I listen to URL changes in Chrome Custom Tabs

Im working on an android app, that requires Chrome Custom Tabs (It uses an API that requires this exact package). 我正在开发一款Android应用,需要Chrome自定义标签(它使用的API需要这个精确的套餐)。

I want to know when ChromeTabs gets redirected to a specific URL, but i haven't found anything useful yet. 我想知道什么时候ChromeTabs被重定向到特定的URL,但我还没有找到任何有用的东西。

Does anyone have experience with this? 有人对此有经验吗?

Thanks 谢谢

Instead of using the ChromeTabs callback method to check the URL, i used deeplinking instead. 我没有使用ChromeTabs回调方法来检查网址,而是使用了深层链接。 I visited this method earlier without any luck, and it seems that because i didn't tell the android to autoVerify it didn't list the app as a browser app. 我之前没有运气就访问了这个方法,似乎因为我没有告诉android自动autoVerify它没有将应用程序列为浏览器应用程序。

<activity
            android:name=".Activity"
            android:launchMode="singleTask">
            <intent-filter android:autoVerify="true"> <--! to tell android 
      that its a browsable app -->
                <data
                    android:host="open"
                    android:scheme="myapp" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
        </activity>

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM