EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

How to use routing when notification tapped when app is on background? #205

Open Guervyl opened 3 years ago

Guervyl commented 3 years ago

I have this code in my app component:

// Inside ngOnInit
LocalNotifications.addOnMessageReceivedCallback(data => this._ngZone.run(() => {
        this.handleNotifikasyon()
}, this));
// Insite the class
handleNotifikasyon(): void {
    this.router.navigate(["/the-path"]])
    console.log('handling')
}

When the app is on the foreground and I tap the notification, the router navigates to the path correctly. But, If I close the app by pressing the back button, and then tap the notification, the app opens, it prints the text handling but it does not navigate to the path.