Hello guys ! I’m trying to learn Ionic to make an app. At the moment I’m stuck with Local Notifications. So what I am trying is when you get a Notification and click on it, you should be redirected to another page. Only nothing is happening so far. I have searched the internet for a solution, yet nothing so far have helped…
I followed the docs for Local Notifications : https://ionicframework.com/docs/native/local-notifications/ .
Scheduling a notification is not a problem. Only Onclick.
this.localNotifications.schedule({
id: 1,
title: msg.title,
text: msg.body
});
When I try this, nothing happens. No console Log, nothing…
this.localNotifications.on('click').subscribe(notification => {
// Logic here
console.log("Notification Clicked");
this.nav.setRoot(BerichtenPage);
});
Other thing I tried, but with this one, I get an error :
‘Expected 1 arguments, but got 2.’
this.localNotifications.on('click',(notification, state)=> {
// Logic here
});
So I’m completely clueless, I hope you guys can help me further with this problem