I am trying to add Progressive Web Apps to my server. I would prefer not to create a new web site for each app. My preference is to add each app to a sub-domain off of a website like this: www.example.com/app1
The problem is that when I run the Statement List Generator here: https://developers.google.com/digital-asset-links/tools/generator
It only works if I place assetlinks.json here: www.example.com. And if that is the case then I can only have one app in www.example.com. I have tried placing assetlinks.json here 1) www.example.com/app1 2) www.example.com/app1/.well-known and 3) www.example.com . The only one that works is #3.
Have also added the following intent filter to androidmanifest.xml and that does not work:
<intent-filter android:label="@string/app_name" android:autoVerify="true" >
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<!-- Edit android:host to handle links to the target URL-->
<data android:scheme="https"
android:host="example.com"
android:pathPrefix="/app1" />
</intent-filter>
I can't believe that you must have a different website for each progressive web app. Any suggestions?
It is possible to do it. As an example, let's say you are developing 2 applications:
And, since those applications are going to be different TWAs, that also means you will have a different package-name for each one:
The assetlinks.json file should be available at https://example.com/.well-known/assetlinks.json and should list both applications:
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app1",
"sha256_cert_fingerprints": ["<APP_1_FINGERPRINT>"] }
},
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app2",
"sha256_cert_fingerprints": ["<APP_2_FINGERPRINT>"] }
}
]
Each application will have its own asset_statements declaration, linking the app to the authorised origin:
[{ "relation": ["delegate_permission/common.handle_all_urls"],
"target": {"namespace": "web", "site": "https://example.com"}}]
A couple of things to be aware of:
If any of the two items above are an issue, using sub-domains would be a better solution.