Reputation: 576
My Android App Links feature was not working until I added the meta-data tag:
<meta-data
android:name="asset_statements"
android:resource="@string/asset_statements"/>
Which is a suggestion I read here and here. However that is not mentioned by Google official documentation.
So... is it really needed or am I doing something else wrong?
(when I mentioned App Links was not working, I should note that deep link works but Android still displays the "default app chooser dialog")
Update #1:
I'm testing on Android 8.1. I've uploaded the .well-known/assetlinks.json
file. Here's my activity handling deep links:
<activity
android:name=".LinkDispatcherActivity"
<intent-filter android:autoVerify="true">
<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="@string/www_app_domain" />
</intent-filter>
</activity>
Upvotes: 1
Views: 1796
Reputation: 576
Ok , after @Michael reply I think I found the reason why.
The website redirects http to https traffic. And once I remove the <data android:scheme="http" />
, I can comment the <meta-data>
tag. In fact, in the docs they mention
Only if the system finds a matching Digital Asset Links file for all hosts in the manifest does it then establish your app as the default handler for the specified URL patterns.
I suppose that applies to all "hosts" and "scheme" as well, even though including the <meta-data>
would kind of override that rule.
Thank you all for replying.
Upvotes: 2
Reputation: 47965
When you use that meta tag Android will validate "ownership" while the install. Only with that tag in your Manifest your app will be opened without any request. I'm talking about the chooser which app you would like to open to handle that url you defined in your manifest.
You can check this command to get the result of the validation, it may helps you to understand what went wrong:
adb shell dumpsys package domain-preferred-apps
See also the documentation regarding that: Verify Android App Links.
Upvotes: 2