2

The new Branch.io Cordova SDK the documentation makes it clear that the SDK automatically closes the current branch session when the app is paused or backgrounded, but it does not seem to automatically init a new session when the app is resumed from memory.

If the app is resumed after it's been killed from memory, the branch.init method in my app's onReady code does execute - this is only an issue when resuming a paused app.

Do I need to trigger another init manually? Any insight would be great!

4

1 回答 1

1

我是 Branch 的 Scott,也是 Web SDK(包括 Cordova SDK)的首席架构师。是的,当应用程序暂停时,SDK 会自动关闭分支会话,这是正确的。但是,它不会(还)在新会话恢复时自动初始化它。resume这意味着,每次事件触发时,您都需要手动触发另一个 init 。

像绑定任何其他启动事件侦听器一样绑定此事件:

...
onResume = function() {
    branch.init('KEY');
};

...

bindEvents: function() {
   document.addEventListener('resume', this.onResume, false);
}
...

我们收到了许多要求在简历上自动调用 init 的请求,并将很快发布!完成后,我会记下更新此回复。

于 2015-06-11T00:51:33.640 回答