I have implemented push notification in ionic Everything working fine on android and but in IOS got different scenario:
- in foreground : onNotification is not fired as well as android working perfect.
- Background: push notification is received but after tap from notification nothing happend
app.component.ts
this.fcm.onNotification().subscribe(data => {
if(data.wasTapped){
console.log(data.wasTapped);
//redirectPageViaNotificationType for redirect page...
this.redirectPageViaNotificationType(data);
} else {
//Notification was received in foreground. Maybe the user needs to be notified
// if application open, show
let confirmAlert = this.alertCtrl.create({
title: (<any>data).title,
message: (<any>data).body,
buttons: [{
text: 'Ignore',
role: 'cancel'
},{
text: 'View',
handler: () => {
//redirectPageViaNotificationType for redirect page...
this.redirectPageViaNotificationType(data);
}
}]
});
confirmAlert.present();
}
});
when any push notification is received its showing notification when my application is closed or background it does not executing the this.fcm.onNotification()function. And i just debug this issue and noticed this, in my xcode console its showing:
Tried Solution
Link :
Add "content_available":true in the notification payload but its not working for me.
https://forum.cometchat.com/t/ionic-push-notification-not-triggered-when-in-foreground-ios/620/8
remove Below plugin :
npm i cordova-plugin-fcm-with-dependecy-updated and local-notification plugin and add it again but not worked for me.
can any one please tell me why its happing and what's going wrong?
