Skip to content

Commit

Permalink
fix: added onDeviceResume to testbed
Browse files Browse the repository at this point in the history
needed because on-background data-received did not work for Android
Cordova (works for Ionic1, Ionic2, and PhoneGap)
  • Loading branch information
ethanneff committed Nov 18, 2016
1 parent d324717 commit 5ed7e91
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
22 changes: 18 additions & 4 deletions testbed/www/js.es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@
// app

var app = {
initialize: function initialize() {
initialize: function() {
this.bindEvents();
},
bindEvents: function bindEvents() {
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
document.addEventListener('resume', this.onDeviceReady, false);
},
onDeviceReady: function onDeviceReady() {
BranchInit(true);
onDeviceReady: function() {
app.branchInit();
},
onDeviceResume: function() {
app.branchInit();
},
branchInit: function() {
// Branch debug
Branch.setDebug(true);

// Branch initialization
Branch.initSession(function(data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
}
};
app.initialize();
Expand Down
16 changes: 15 additions & 1 deletion testbed/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,23 @@ var app = {
},
bindEvents: function bindEvents() {
document.addEventListener('deviceready', this.onDeviceReady, false);
document.addEventListener('resume', this.onDeviceReady, false);
},
onDeviceReady: function onDeviceReady() {
BranchInit(true);
app.branchInit();
},
onDeviceResume: function onDeviceResume() {
app.branchInit();
},
branchInit: function branchInit() {
// Branch debug
Branch.setDebug(true);

// Branch initialization
Branch.initSession(function (data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
}
};
app.initialize();
Expand Down

0 comments on commit 5ed7e91

Please sign in to comment.