Ionic 3 tabs active

i have 5 tabs in my ionic 3 app and they are working as expected with in the app.

Now i’m implementing FCM push notifications and i’m trying to redirect the user from the notification to specific screen using below code

this.fcm.onNotification().subscribe(data => {
          if(window.localStorage.getItem("rememberMe") == "true"){
            this.rootPage = TabsPage;
            if(data.location == "Page2"){

              this.eve.publish('user:created', 0);
              setTimeout(() => {
              }, 100);

            } else if(data.location == "Page1"){
              this.eve.publish('user:created', 0);
            } else if(data.location == "Page3") {
              this.eve.publish('user:created', 3);
          console.log("Received in background");
        } else {
          console.log("Received in foreground");

this is working fine when the app is killed or not in background mode and i’m able to redirect the user to desired pages along with appropriate tabs are being active.

But when the app is in background mode pages are again loading perfectly but the active tab is not getting selected instead its showing previously selected tab.


<ion-tabs selectedIndex={{dat}} (ionChange)="tada($event)">
  <ion-tab style="font-family:segoeprb" [root]="tab1Root" tabTitle="tab1" tabIcon="icon"></ion-tab>
  <ion-tab [show]="guest" [root]="tab2Root" tabTitle="tab2" tabIcon="icon"></ion-tab>
  <ion-tab [show]="guest" [root]="tab3Root" tabTitle="tab3" tabIcon="icon"></ion-tab>
  <ion-tab [root]="tab4Root" tabTitle="tab4" tabIcon="icon"></ion-tab>
  <ion-tab [show]="guest" [root]="tab5Root" tabTitle="tab5" tabIcon="icon"></ion-tab>

here i’m using selectedIndex appended to dat and i’m updating it using events which is pushed from app.component as you can see.


eve.subscribe('user:created', (data) => {
       this.dat = data;

here i can see the passed index value of tab, but its not updating when the app is in background mode.