You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following code:
In app.component.ts: this.platform.ready().then(async () => { this.oneSignalNotificationService.bindNotifications(); });
In onesignal.service.ts: bindNotifications(): void { OneSignal.initialize(environment.onesignalAppId); console.log("bindNotifications"); OneSignal.Notifications.addEventListener('click', async (e) => { console.log("eventListener"); //Something else }); }
bindNotifications is displayed only once per console but eventListener is executed more than 30 times.
Steps to reproduce?
1. Build application
2. Initialize the application
3. Send notification
4. Click on the notification
What did you expect to happen?
bindNotifications to be displayed only once and eventListener to be displayed only once for each time a notification is clicked.
OneSignal Cordova SDK version
5.0.3
Which platform(s) are affected?
iOS
Android
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
We ran into a similar issue today. Our app is not a pure SPA and we do full-page navigation from time to time. Every time this happens, platform.ready() is fired again and another listener is added. Removing the listener before adding it does not help, because the remove is not propagated from JS to the native layer. It only removes the listener from JS.
This was not an issue in previous versions of the SDK because it used OneSignal.setNotificationOpenedHandler and the previous listener was replaced.
I think there should be an option to clear existing listeners, or listeners should automatically be cleared when OneSignal.initialize is called.
What happened?
I have the following code:
In app.component.ts:
this.platform.ready().then(async () => { this.oneSignalNotificationService.bindNotifications(); });
In onesignal.service.ts:
bindNotifications(): void { OneSignal.initialize(environment.onesignalAppId); console.log("bindNotifications"); OneSignal.Notifications.addEventListener('click', async (e) => { console.log("eventListener"); //Something else }); }
bindNotifications is displayed only once per console but eventListener is executed more than 30 times.
Steps to reproduce?
What did you expect to happen?
bindNotifications to be displayed only once and eventListener to be displayed only once for each time a notification is clicked.
OneSignal Cordova SDK version
5.0.3
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: