Support Android App Links for some domains, and Direct Links for other domains!

Bram Yeh
2 min readDec 3, 2020

--

One Verification Fails, All App Links Fail

(I knew it’s an odd case.) Our android app fully supports Android App Links, and it works perfectly. And then, the app is demanded to handle more domains, however, some domains‘ web servers cannot put the assetlinks.json files onto.

Use ATS policy to redirect assertlinks.json? No, the assetlinks.json file must be accessible without any redirects. And the Android system will verify every host specified in the intent filters’ data elements. If any verification fails, the app is not verified to be a default handler for any of the URL patterns defined in the AndroidManifest.xml.

If we add the URL patterns of new domains into the app’s intent filters, all our App Links fail because the verifications of those new domains fail. If we don’t add the URL patterns of new domains, our users cannot open those contents in our app from mobile browsers.

How about removing all App Link invalid domains from the app’s intent filters? Not acceptable because those domains still need Deep Links. We need to support App Links for some domains, and support Direct Links for the other domains (those web servers can’t add the assetlinks.json files) together in our app.

Request App Links Verification Only for Valid Domains

To enable link handling verification for App Links, we have to set android:autoVerify=”true” in any one of the web URL intent filters that include the android.intent.action.VIEW intent action and android.intent.category.BROWSABLE intent category.

On the contrary, if we move those invalid domain out to other intent filters without android:autoVerify=”true”, the Android system won’t verify those URL patterns.

It’s important to verify app link works or not. To follow Check link policies, use commend adb shell dumpsys package d to see the current link-handling setting:

https://developer.android.com/training/app-links/verify-site-associations#check-link-policies

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Bram Yeh
Bram Yeh

Written by Bram Yeh

Lead Android & iOS Mobile Engineer at Yahoo (Verizon Media) Taiwan https://www.linkedin.com/in/hanruyeh/

No responses yet

Write a response