How to create assetlinks.json when website is handled by multiple apps

app explorer picture app explorer · Jan 2, 2018 · Viewed 7.1k times · Source

In order to link my app with the web page in need to define assetlink.json like below.

[{
"relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "package name",
    "sha256_cert_fingerprints":
    [key]
  }
}]

My website having a number of modules, say example in a news site having separate sections like news, car review, garget review, horoscope/astrology, cooking, live tv etc. In this case, the news portal has android app for each module with separate android apps and whereas all the modules are under the single domain. Then how can we define our assetlink.json

Answer

Nexus7_2012 picture Nexus7_2012 · Aug 26, 2018

Associating a website with multiple apps (In answer to "How to create assetlinks.json when website is handled by multiple apps")

https://developer.android.com/training/app-links/verify-site-associations#multi-subdomain

A website can declare associations with multiple apps within the same assetlinks.json file. The following file listing shows an example of a statement file that declares association with two apps, separately, and resides at https://www.example.com/.well-known/assetlinks.json:

[{
  "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"]
  }
}]