app explorer
app explorer

Reputation: 173

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

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

Upvotes: 17

Views: 37282

Answers (2)

Nexus7_2012
Nexus7_2012

Reputation: 764

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

Upvotes: 34

Ruben Miquelino
Ruben Miquelino

Reputation: 1117

Just to complement the correct answer, if you want different apps to handle different sections (folders) of your site, after adding your apps SHA256 keys to your domain, you should in the app it self create and intent-filter on the AndroidManifest to match the section that you want that app to open.

Something like this

<intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" android:host="somedomain.com" android:pathPattern="/section/*" />
        </intent-filter>

Upvotes: 3

Related Questions