Universal Links to multiple apps

Apple Recommended

Replies

Hi Universalis! It is possible to specify associated domains data for multiple applications. The system will walk the data in the order it appears in your apple-app-site-association file. So, for instance, if you have two apps, "0123456789.com.example.fruits" and "0123456789.com.example.veggies", and what to preferentially open universal links in "Veggies", you'd write something like this:

Code Block json
{
"applinks": {
"details": [{
"comment": "Veggies is listed first.",
"appIDs": [ "0123456789.com.example.veggies" ],
"patterns": [
{ "/": "/nom-nom/*" }
]
},
{
"comment": "Fruits is listed second, and is only consulted if the first section didn't match anything on the user's device.",
"appIDs": [ "0123456789.com.example.fruits" ],
"patterns": [
{ "/": "/nom-nom/*" },
{ "/": "/fruits-but-not-veggies/*" }
]
}]
}
}


Of course, your app IDs and pattern dictionaries are specific to your applications. And they can differ between applications—in this example, note that "Fruits" also matches a separate pattern that "Veggies" doesn't match.

And what is the behavior if both appIds are listed in the appIds array of the same details entry?

  • Same question - is this behavior documented anywhere?

  • I think I'm running into a problem with this exact scenario. My experience is that if a user has both apps installed, it will open the app that first matches the URL. We're having to separate our AASA similar to the above now to avoid this issue.

  • yep @Bryon_W , it will open the app that first matches the URL, you're correct.

Add a Comment