androiddeep-linkingandroid-deep-linkdigital-assets-links

AssetLinks file expected traffic and failure scenarios


I am working on setting up my Android app to work with HTTP Web Links according to the various guides and protocols and have successfully setup the deeplinks which includes serving my assetlinks file from /.well-known/assetlinks.json. Everything is working as expected. What I am struggling with from an operational perspective is how to go about maintaining this file -- specifically during update and failure scenarios.

Let's say I have existing customers who have downloaded my app and are using weblinks just fine. I update my assetlink file and push the new version to my server. When do my customers get the updated assetlink file? Is the OS configured to check for updates on some cadence or app launch? Is it only on app update or reinstall?

Similarly, imagine my website is down. New users are installing my app and the OS will not be able to associate my domain and when customers click the HTTP web links they will not be deeplinked into the app. This makes sense. But after I recover from my outage when will the customer get their assetlink file given the app is already installed?

Similarly lets say I upload an invalid assetlinks.json file. Will this break the current web links for existing customers who already had a valid association when they first installed the app?

Understanding these issues will ultimately help me better troubleshoot customer issues and tune the expected traffic I should expect to see for my assetlinks file from my server.


Solution

  • Let me try to briefly put down how app linking works. I'm listing down all the things which I have learned gathered while playing with app links. Also attaching a very good article which covers in more details about the following.

    There are two key components in registering and updating app links: Package manager and Intent Filter Verifier. These are the usual steps in which the workflow runs:

    1. Every time an app is installed or updated through the package manager an intent named INTENT_FILTER_NEEDS_VERIFICATION is generated.

    2. The Intent Filter Verifier looks up the domains specified in the tags defined in the manifest of your app.

    3. For every domain/hostname specified for the app, the IntentFilterVerfier tries to fetch statements for each of the domain using an API call.

      • A sample API call for the domain google.com looks like this
      • The APIs documentation of this is carefully hidden by google at Digital Asset Links
    4. Based on the result of the API call, the domain/hostname is categorized into one of the following buckets

      undefined — apps which do not have link auto-verification enabled in their manifest
      ask — apps which have failed verification (i.e. ask the user via the "Open with" dialog)
      always — apps which have passed verification (i.e. always open this app for these domains)
      never — apps which have passed verification, but have been disabled in the system settings
      
    5. Package Manager updates and applies the behavior.

    Failure handling

    You can get more information and debug workflows in this very well written Blog by Christopher Orr