Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding deep linking data to the MainActivity intent-filter removes the icon in the device

I'm trying to add deep linking to my app and when I add:

<data android:scheme="http"
                android:host="www.example.com"
                android:pathPrefix="/gizmos" />

to the intent filter in my MainActivity the icon is not installed in the device after compiling.

Here is the activity part on the manifest:

    <activity
        android:name=".MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:windowSoftInputMode="adjustPan"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http"
                android:host="www.example.com"
                android:pathPrefix="/gizmos" />

        </intent-filter>
    </activity>

1 Answers

You need two separate intent-filter.

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </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="http"
                    android:host="www.xxx.com"
                    android:pathPrefix="/app" />
    </intent-filter>
like image 116
DanielTseng Avatar answered Jan 23 '26 05:01

DanielTseng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!