OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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