繁体   English   中英

Android使用Intent Filter打开应用程序链接无效

[英]Android opening app link using Intent Filter is not working

我在清单中使用以下代码向移动用户内部的任何来源尝试打开相关网址时向用户显示选项,但它会自动打开Web浏览器而不是在选项中显示我的应用程序。 可能是什么问题?

<activity android:name=".VisitWebPage" >
            <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="http" />
                <data android:scheme="https" />
                <data android:host="www.mysite.com" />
                <data android:pathPattern="/.*" />
             </intent-filter>
        </activity>

您能否尝试将数据标签更改为:

    <data android:scheme="http"
          android:host="www.mysite.com" />
    <data android:scheme="https"
          android:host="www.mysite.com" />

您必须像这样使用,它为我工作。

<activity
                android:name=".MainActivity"
                android:screenOrientation="portrait">
                <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="mysite.com"
                    android:pathPrefix="/m/showroom/mypage"
                    android:scheme="http" />
            </intent-filter>
        </activity>

暂无
暂无

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

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