簡體   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