diff --git a/README.md b/README.md index 4a33568a..70a00a72 100644 --- a/README.md +++ b/README.md @@ -160,11 +160,21 @@ StatusBar.styleDefault(); } - // Branch initialization - Branch.initSession(function(data) { - // read deep link data on click - alert('Deep Link Data: ' + JSON.stringify(data)); + // Branch + $ionicPlatform.on('deviceready', function(){ + branchInit(); }); + $ionicPlatform.on('resume', function(){ + branchInit(); + }); + + function branchInit() { + // Branch initialization + Branch.initSession(function(data) { + // read deep link data on click + alert('Deep Link Data: ' + JSON.stringify(data)); + }); + } }); }) // ... @@ -176,6 +186,7 @@ import { Component } from '@angular/core'; import { Platform } from 'ionic-angular'; import { StatusBar, Splashscreen } from 'ionic-native'; + import { TabsPage } from '../pages/tabs/tabs'; // Branch import @@ -191,13 +202,22 @@ platform.ready().then(() => { StatusBar.styleDefault(); Splashscreen.hide(); + BranchInit(); + }); - // Branch initialization - Branch.initSession(function(data) { + platform.resume.subscribe(() => { + BranchInit(); + }); + + // Branch initialization + function BranchInit() { + // only on devices + if (platform.is('core')) { return } + Branch.initSession(data => { // read deep link data on click alert('Deep Link Data: ' + JSON.stringify(data)); }); - }); + } } } ```