如果未安装应用程序,如何从深层链接重定向到应用程序商店?

时间:2018-12-03 15:52:13

标签: android ios react-native mobile deep-linking

我希望用户能够通过Facebook等共享链接(例如,app.com / SKFLA-这主要是因为无法点击深层链接)。单击后,此链接将重定向到深层链接app:// SKFLA。如果已安装该应用程序,则将打开该应用程序-到目前为止一切正常。但是,如果未安装应用程序,我想在相关页面上打开应用程序商店。这可以实现吗?谢谢!

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

不确定本机行为。 我们使用了https://branch.io/deepviews/之类的第三方服务。 有很多类似的服务。

答案 2 :(得分:0)

如果有人仍然陷在这个问题中,并且需要最简单的解决方案,那么您会喜欢节点深链接

1。)如果已安装应用程序:通过深度链接调用应用程序将始终调用根组件的componentDidMount。因此,您可以在此处附加一个侦听器。喜欢:

Linking.getInitialURL()
      .then(url => {
        if (url) {
          this.handleOpenURL({ url });
        }
      })
      .catch(console.error);

    Linking.addEventListener('url', this.handleOpenURL);



handleOpenURL(event) {
    if (event) {
      console.log('event = ', event);
      const url = event.url;
      const route = url.replace(/.*?:\/\//g, '');
      console.log('route = ', route);
      if(route.match(/\/([^\/]+)\/?$/)) {
        const id = route.match(/\/([^\/]+)\/?$/)[1];
        const routeName = route.split('/')[0];

        if (routeName === 'privatealbum') {
          Actions.privateAlbum({ albumId: id });
        }
      }
    }
  }

2。)如果未安装应用程序:只需在服务器中设置一条路由,并且节点-deeplink程序包将处理未在移动设备中安装应用程序时Web浏览器到应用程序商店之间的桥接。

这样,这两个案件都将得到轻松处理

相关问题