在浏览器android中打开自定义url时重定向应用程序



当用户打开类似的自定义url时,如何在没有对话框的情况下重定向我的应用程序(选择选项)

https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknextp=1233-4503223

我试着在我的android清单中使用意向过滤器,比如这个

 <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:scheme="https" 
                android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&amp;isAuthSuccessful=true*"/>
            <data
                android:scheme="http"
                android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&amp;isAuthSuccessful=true*"/>
        </intent-filter>  

但它不起作用,但当我尝试过这样的代码时

 <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:scheme="https" 
                android:host="signin.ebay.com" />
            <data
                android:scheme="http"
                android:host="signin.ebay.com"/>
        </intent-filter>  

它工作,但它显示对话框ChooseOption有时我打开带有url的浏览器https://signin.ebay.com或http://signin.ebay.com

如何让用户打开url时这个

https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknextp=1233-4503223

他们会重定向到我的应用程序,没有对话框ChooseOption,我的tknexp不是静态的,记住,谢谢

它要求选择选项,因为您已经给定了android:scheme="https"。因此,Android将寻找支持android:scheme="https"的应用程序,并向用户显示是否有多个应用程序负责该方案。

为了避免这种情况,将android:scheme="https"更改为android:scheme="<your own scheme>",这只由您的应用程序处理。这将直接重定向到您的应用程序。

现在,在您的活动onCreate方法中,您将收到URL,而不是https://。但现在您已经完全控制了url,您可以将其更改为https://

最新更新