In Cordova IOS Platform, onesignal is initialized, but i'm not getting any notifications? It works fine in android
Dev-Pradeep-NS opened this issue · comments
How can we help?
if (window.plugins && window.plugins.OneSignal) {
var onesignalKey = "provided key here"
window.plugins.OneSignal.initialize(onesignalKey);
let handleNotificationReceived = function (jsonData) {
C('Did I receive a notification: ', jsonData);
let notification = jsonData.notification;
if (notification.title) {
that.annoDialog('<b>' + notification.title + '</b><br><br>' + notification.body);
} else {
that.showDialog(notification.body);
}
};
window.plugins.OneSignal.Notifications.addEventListener("foregroundWillDisplay", handleNotificationReceived);
const handleNotificationOpened = (jsonData) => {
const notificationPayload = JSON.stringify(jsonData);
that.redirectTo('app/events/upcoming');
console.log(notificationPayload);
};
window.plugins.OneSignal.Notifications.addEventListener("click", handleNotificationOpened);
window.plugins.OneSignal.Notifications.requestPermission(true).then((accepted) => {
console.log("User accepted notifications: " + accepted);
});
}
Code of Conduct
- I agree to follow this project's Code of Conduct
I'm closing this issue, as no one responding to this