我想做的是允许用户定义要使用应用程序处理的 url 域。
因此,如果用户输入“https://www.mydomain.com”,应用程序应处理与该域的所有链接。它还可能需要处理多个 url。
首先,这可能吗?其次,如何实现?我正在使用表单,但显然我可以在特定于平台的项目中执行此操作。
此外,这在 Android 以外的平台上是否可行?
最后,作为后备方案,这可以作为应用 list 或代码中的通配符“*.somedomain.com”来完成吗?
最佳答案
由于 url 处理程序是在 list 中定义的,因此这是不可能的。您无法为 wildcard subdomains 添加处理程序:
The Digital Asset Links protocol treats subdomains as unique, separate hosts. If your intent filter lists both the www.example.com and mobile.example.com subdomains as hosts, you must host a separate assetlink.json file on each subdomain. For example, an app with the following intent filter declaration would pass verification only if the website owner published valid assetlinks.json files at both https://www.example.com/.well-known/assetlinks.json and https://mobile.example.com/.well-known/assetlinks.json
关于android - 您可以在运行时注册 url Intent 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41199230/