Ionic 4 & FCM - App needs user interaction (tap on device screen) for the app navigation to work properly

Hi, I’m facing a problem with navigation in Ionic 4 and it’s interaction with FCM onNotification trigger.

Here’s the page structure in my app:

home-page -> new-page
          -> old-page

If the app was launched normally with home-page as the starting point, I find no problem. I’m able to navigate freely and use the back button (android) to go back to previous page.

But if open the app by clicking on background notification sent by FCM, which causes the app to navigate to home-page/new-page (code below), when new-page appears, if I tap on device’s back button the app exits when it’s supposed go back to home-page instead.

I thought that’s because the navigation history is empty, but this doesn’t seem to be the case. Because if I tap the screen once before hitting the back button, the app navigates to home-page rather than exiting.

Here’s how I handle the notification:

this.platform.ready().then(() => {
      this.fcm.onNotification().subscribe(data => {
            if (data.wasTapped) {
                   this.navCtrl.navigateForward(['home-page', 'new-page']);

Any idea on how to resolve this? thank you :smiley: