Search code examples
iosapple-push-notificationscapacitor

Hybrid app hybernated when opened via push notification


I've got my iOS angular/capacitor app which is able to receive and manage push notification via capacitor event:

// Method called when tapping on a notification
PushNotifications.addListener('pushNotificationActionPerformed',
  async (action: ActionPerformed) => {
      await this.router.navigateByUrl('url/to/go')
      console.log('logic done);
  }
);

What happen from the tap is absolutely singular: logs confirm my actions are done, but in my app nothing happens UNTIL I tap any part of the UI. Then the route correctly update to destination. Tested in iPhone 6 iOS 12.5

How can this be?


Solution

  • I found the solution by my own: for some reason ? cannot explain I need to wrap the router statement inside ngZone service:

    this.ngZone.run(() => this.router.navigateByUrl(path));

    If someone can explain these I'll appreciate :)