I want to show notification with title, sub title and banner image when push notification comes. How to do that.
Please have a look to this link : http://prntscr.com/pu2jva
I want to show notification with title, sub title and banner image when push notification comes. How to do that.
Please have a look to this link : http://prntscr.com/pu2jva
Google “push notification cordova”
I have added the below plugin.
cordova plugin add cordova-plugin-fcm
My code is
//Here you define your application behaviour based on the notification data.
FCMPlugin.onNotification(function(data){
debugger
console.log("Received Data " + data);
if(data.wasTapped){
//Notification was received on device tray and tapped by the user.
var notificationCallbackOnClose = app.notification.create({
icon: '<i class="icon material-icons md-only"><img src="images/mission-shakti-logo-odia.jpg" class="push-noti-image"/></i>',
title: 'Title',
titleRightText: 'now',
subtitle: data.title,
text: data.message,
closeOnClick: true,
closeTimeout: 5000,
on: {
close: function () {
app.views.main.router.navigate('/notification/');
//notificationCallbackOnClose.destroy();
}, notificationClick: function () {
app.views.main.router.navigate('/notification/');
}
},
});
notificationCallbackOnClose.open();
app.views.main.router.navigate(’/notification/’);
} else {
//Notification was received in foreground. Maybe the user needs to be notified.
// With callback on close
var notificationCallbackOnClose = app.notification.create({
icon: ‘’,
title: ‘Title’,
titleRightText: ‘now’,
subtitle: data.title,
text: data.message,
closeOnClick: true,
closeTimeout: 5000,
on: {
close: function () {
//notificationCallbackOnClose.destroy();
}, notificationClick: function () {
app.views.main.router.navigate('/notification/');
}
},
});
notificationCallbackOnClose.open();
}
});
Did not find a solution yet…