当用户未安装应用程序时,如何通过单击动态链接直接进入App Store?

时间:2019-01-21 05:54:14

标签: android ios firebase firebase-dynamic-links dynamic-links

当前,React-native应用程序中通常使用Dynamic Link。但是,当用户未安装应用程序时,动态链接不会重定向到应用程序商店。

createShortDynamicLink(contentKey, title, subtitle, youTubeVideoId) {
  const dynamicLinkDomain = __DEV__
    ? 'test.page.link'
    : 'test.page.link';

  const link =
    new firebase.links.DynamicLink(`https://test.com/contents/${contentKey}`, dynamicLinkDomain)
      .social.setImageUrl(`https://img.youtube.com/vi/${youTubeVideoId}/hqdefault.jpg`) // make size over 200*200
      .social.setDescriptionText(subtitle)
      .social.setTitle(title)
      .android.setPackageName(DeviceInfo.getBundleId())
      .ios.setBundleId(DeviceInfo.getBundleId());

  return firebase.links()
    .createShortDynamicLink(link, 'UNGUESSABLE');
}

https://firebase.google.com/docs/dynamic-links/use-cases/web-to-app https://rnfirebase.io/docs/v5.x.x/links/reference/SocialParameters 我使用了这个文档。

1 个答案:

答案 0 :(得分:0)

您需要设置后备链接。您可以在official page.

中找到有关属性的更多选项