Open thedotbest opened 1 year ago
same here
@Lakston @thedotbest this is actually the expected behavior - pushes in iOS are handled by the operating system itself, without notifying the app at all, so unless a notification is opened, there is no way for the app to know about it. This is solved by adding an additional NotificationServiceExtension target to your app, which will handle pushes before a notification is created. However it works only in native apps right now, as there is no way to pass notification data from Notification Service Extension to javascript code of your app.
We are looking for a solution right now, and I will update this thread as soon as there is any progress.
@thedotbest I'm sorry I missed the part that notifications are not received at all - I thought it is only about the callback. In this case, this is definitely not the expected behavior, and this is really strange. As I mentioned above, iOS itself draws notifications without your app's interference unless you have a way to intercept pushes with a NotificationServiceExtension. By any chance can you share a simple reproducer project with us?
@Lakston do you also have issues with notifications not appearing in background, or do you only have an issue with the callback?
So with react native and pushwoosh we can’t retrieve and store push notification in background on IOS !!!
@thedotbest this is the platform limitation - pushes are handled and notifications are generated by the operating system itself, so there is no way for an app to know a push is received unless you open a notification - then the OS will pass the notification's payload to the app.
The only way for an app to know a push is received in background is to add a Notification Service Extension target to your native iOS project. The harder part is to pass the data from this extension to your Javascript project though as it requires creating a Native Module on top of the extension code. And, since the extension has to be added manually, we cannot add it automatically when Pushwoosh plugin is installed.
Right now we are working on updating the native SDK code to allow passing notifications payloads from Notification Service Extensions to our native iOS SDK, which will, in turn, allow passing the data to the plugins' code.
Meanwhile, you can still use the pushReceived
callback, however, please note that it will only be called when a push is received in foreground, or when a notification is opened in background (pushReceived
will be called with the pushOpened
callback in that case).
Hi
I use pushwoosh with react native and i don't receive notification on ios when app is background.
DeviceEventEmitter.addListener('pushReceived', (pushReceived) not firing while app IOS is in background It's ok on android and foreground is ok