I'm trying to configure deeplinks for my app. I configured several options like:
https://myapp.com/news ---> NewsActivity
https://myapp.com/history ---> HistoryActivity
with intent filters like:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:pathPrefix="/news" />
</intent-filter>
and
<intent-filter android:label="MyApp">
<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="myapp.com"
android:pathPrefix="/history" />
</intent-filter>
I also want a link pointing from the base domain to my main activity
https://myapp.com ---> MainActivity
I want the link to respond to the base domain but no to other links like: https://myapp.com/playlists since the playlist features is not currently implemented in the app and is better to redirect to the web.
But when I set the intent filter:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:path="" />
</intent-filter>
I receive the following lint warning:
android:path cannot be empty
Ensure the URL is supported by your app, to get installs and traffic to your app from GoogleSearch.
More info: https://g.co/AppIndexing/AndroidStudio
Despite this warning, the behavior it is correct. How can I fix this warning?
Had the same issue, you can just ignore the warning with tools:ignore="AppLinkUrlError"
So your intent would be:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:path=""
tools:ignore="AppLinkUrlError" />
</intent-filter>
Add xmlns:tools="http://schemas.android.com/tools" to your initial manifest tag if it's not already there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With