我需要在 Android 上使用 Dynamic Link Builder API 以编程方式构建动态链接 ( https://firebase.google.com/docs/dynamic-links/android/create )。这是适用于我的情况的唯一选项,因为我需要跟踪点击数据并缩短链接。
此链接可以在桌面上打开,但问题是该链接仅适用于移动应用程序 - 网站无法识别此链接(此行为是故意的)。我希望桌面用户被定向到网站的主页。
以下是 Firebase 文档中的引用:
When users open a Dynamic Link on a desktop web browser, they will load this URL (unless param dfl is specified). If you don't have a web equivalent to the linked content, the URL doesn't need to point to a valid web resource. In this situation, you should set up a redirect from this URL to, for example, your home page.
我发现我需要 dfl 参数。 (dfl 是要在桌面上打开的链接,覆盖参数链接。)如何在 Android 上使用 Dynamic Links Builder 指定 dfl 参数?
我知道我可以通过手动构建动态链接来指定dfl - https://firebase.google.com/docs/dynamic-links/create-manually 但这种方法对我来说没有用,因为它有这样的限制:
If you don't need to track click data in the Firebase console and you don't care if the links are long...
有人知道正确的解决方案或一些技巧来实现这一目标吗?任何想法/想法将不胜感激!
最佳答案
看来,这个简单的附加确实有效......
当构建器编写 Uri 时,我会在其后面附加 &dfl=XXXXX
当我尝试在浏览器 PC 上打开此链接时,它会将我定向到 dfl 参数中的 URL,但在设备上,它会打开 Play 商店或应用程序(如果已安装)。
缺少这样的方法让我很困惑,但找到了解决方案。
关于android - Firebase 动态链接生成器中的 DFL 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45143144/