branch.io deepview没有按预期工作

时间:2017-04-17 14:32:03

标签: javascript android angularjs deep-linking branch.io

我们有一个移动网站,我们正在尝试使用branch.io将我们的移动网页用于深度视图。

我们按照以下链接中提到的步骤进行操作:https://dev.branch.io/features/website-to-app-routing/guide/

我们创建了一个只有1个参数的新网址,即$ fallback_url = www.xxx.com/a/b,并在我们的angular js移动网站中嵌入了以下js代码。我们的android URI架构是abc:// a?x = y

我们在head标记中添加了branch.io web sdk,并在script标记中添加了以下脚本。

// load the Branch SDK file
branch.init('Test_key', function(data) {});
// define the deepview structure
branch.deepview({
  'channel': 'mobile_web',
  'feature': 'deepview',
  data: {
    '$deeplink_path': 'a?x=y'
  }
}, {
  'open_app': true // If true, Branch attempts to open your app immediately when the page loads. If false, users will need to press a button. Defaults to true
}, function() {
  branch.deepviewCta();
  console.log('callback');
});

现在问题是移动网站被正确加载,但是当它在网页加载后尝试打开移动应用程序时,它尝试使用网址重定向为" intent:// open?branch_link = zzzz&#34 ;而不是deeplink_url变量中提到的模式。

请帮助。

1 个答案:

答案 0 :(得分:0)

来自Branch.io的Alex:

这是分支链接的正确预期行为

分支链接作为键:值对的存储框 - 在创建链接时指定任意数量的链接(创建链接是在deepview()调用的幕后发生的事情),然后分支处理在应用程序启动后将数据返回给您。

$deeplink_path参数是特殊的,因为除了在应用启动时返回,分支SDK将检测它并且(在Android和iOS< 9上)自动尝试加载该URI目标。 但是,此参数仍包含在链接中,所有逻辑都发生在另一端,而不是移动网站加载时触发的路径。