Hello, I am using the following code to send Push Notifications to devices using Google Cloud Messaging using Angular HTTP.
it works very well when app in backgroud
let body = {
notification: {
title: "Push Notification",
body: "This is a sample push notification",
sound: "default",
click_action: "FCM_PLUGIN_ACTIVITY",
icon: "fcm_push_icon"
},
to: pushToken,
priority: "high",
restricted_package_name: ""
};
let headers = { Authorization: "key=" + gcmKey };
this.http.post("https://fcm.googleapis.com/fcm/send", body, headers).then(response => {
//Response with 200 OK status, but no multicast ID.
resolve(response);
}).catch(err => {
reject(err);
});
i want to be able to get this notification when app in foreground.
any help please?