RE: Notification not showing in background IONIC3 .

reda zejli, modified 7 Years ago. New Member Posts: 10 Join Date: 9/1/16 Recent Posts

Hello community, I am facing an issue !! I am developping an hybrid app in ionic3 and I need to implement push notification, I use as backend liferay6.2. And everything seems fine cause I can now send messages from Cloud Messaging in firebase console.And My phone receuives the message when I am in foreground or background mode ,The problem is that when I try to send from push notification module in liferay, I receive the message in foreground but when I kill the app or I turn to background mode I receive nothing.Any help please, The code of on('notification') below : 

 

 

pushObject.on('notification').subscribe((notification: any) => {

//if user using app and push notification comes

if (notification.additionalData.foreground) {

// if application open, show popup

let confirmAlert = this.alertCtrl.create({

title: 'New Notification',

message: notification.message,

buttons: [{

text: 'Ignore',

role: 'cancel'

}, {

text: 'View',

handler: () => {

alert("Hello World");

}

}]

});

confirmAlert.present();

} else {

//if user NOT using app and push notification comes

//TODO: Your logic on click of push notification directly

// this.nav.push(DetailsPage, { message: data.message });

alert('Push notification clicked');

console.log('Push notification clicked');

}

console.log('Received a notification', JSON.stringify(notification))

});

 

Thank you in advance

 

 

 

 

 

thumbnail
Victor Galan, modified 7 Years ago. Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts

Hey

 

In which platform are you observing this behavior?