Search code examples
androidandroid-app-linksdigital-assets-links

Is there an order of preference when associating a website with multiple Android apps?


Based on the documentation (Associating a website with multiple apps), it is possible to associate multiple apps as handlers for a website's links. The DAL looks as such:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example.puppies.app",
    "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
  },
  {
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example.monkeys.app",
    "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
}]

Is there a concept of ranking for these entries? If the user has both apps installed, which one will open? I'm hoping there's a deterministic way to ensure one has priority over another.

I am unable to verify the actual behavior due to the issue I'm raising separately here.


Solution

  • This can be accomplished by setting the priority flag on the intent filter.

    https://developer.android.com/guide/topics/manifest/intent-filter-element#priority