Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question]: Run OneSignal in parallel with expo-notifications #177

Open
1 task done
dgsunesen opened this issue Apr 13, 2023 · 18 comments
Open
1 task done

[question]: Run OneSignal in parallel with expo-notifications #177

dgsunesen opened this issue Apr 13, 2023 · 18 comments
Labels
Compatibility Issue Help Wanted Extra attention is needed

Comments

@dgsunesen
Copy link

dgsunesen commented Apr 13, 2023

How can we help?

So I'm experiencing some issues with OneSignal (onesignal-expo-plugin) and expo-notifications running in parallel. Ever since I installed and enabled OneSignal in my app, all listeners for handling user interactions on push notifications are not working anymore. For instance, a user sents another user a message, we send a push notification (using expo-server-sdk), the recipient taps the notification and is send directly to the chat.

To achieve this, I would do something like Notifications.addNotificationResponseReceivedListener(listener) with expo-notifications. Unfortunately, ever since OneSignal was enabled, this is not working. Stuff like requesting permission is working just as before, only listeners seems to be broken.

On the other hand, if I listen for push notifications send with OneSignal, I'm able to react to those using the below example:

OneSignal.setNotificationOpenedHandler(openedEvent => {
  console.log("OneSignal: notification opened:", openedEvent);
  const { action, notification } = openedEvent;
});

Isn't it possible to have both running at the same time?

OneSignal Expo SDK version

1.3.1

Platform

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby emawby added Help Wanted Extra attention is needed Compatibility Issue labels Apr 13, 2023
@emawby
Copy link
Contributor

emawby commented Apr 13, 2023

@dgsunesen Thank you for reporting we will need to investigate the compatibility problem. When you send a notification from OneSignal are you able to receive events on the "Notifications.addNotificationResponseReceivedListener" or just the OneSignal handler?

@dgsunesen
Copy link
Author

dgsunesen commented Apr 14, 2023

@emawby Only on the OneSignal handler

It seems the issues is only around listening to notification events, whereas e.g. requesting permission like Notifications.requestPermissionsAsync() (https://docs.expo.dev/versions/latest/sdk/notifications/#requestpermissionsasyncpermissions) is still working.

@emawby
Copy link
Contributor

emawby commented Apr 14, 2023

Interesting ok we will investigate. We use something called swizzling to intercept notification events, but we forward them on so that other handlers still receive them. There could be an issue around this when using expo-notifications.

@dgsunesen
Copy link
Author

Any news on this?

Let me know if there is anything else you'd need from me in terms of more information or the like

@dgsunesen
Copy link
Author

Would be nice to get an update on this :-)

@emawby
Copy link
Contributor

emawby commented Apr 24, 2023

Hello unfortunately we do not have any news to share yet. Are you seeing this warning when your app is started? https://github.com/expo/expo/blob/168ee43f71f005baa11edf98e518593443e1807a/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L32

@dgsunesen
Copy link
Author

Hello unfortunately we do not have any news to share yet. Are you seeing this warning when your app is started? https://github.com/expo/expo/blob/168ee43f71f005baa11edf98e518593443e1807a/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L32

No, I don't see that warning

@emawby
Copy link
Contributor

emawby commented Apr 25, 2023

Ok I noticed this issue in their repo as well. I will continue trying to dig through their implementation to find the conflict.

@dgsunesen
Copy link
Author

@emawby So meanwhile I've been looking into customer.io and they seem to have some of the same issues. You can see it here — maybe you can get more insights on the issue from that.

@emawby
Copy link
Contributor

emawby commented May 11, 2023

@dgsunesen That is helpful I will see if we can make a similar fix

@pratikdhody
Copy link

Any luck @emawby ?

@dgsunesen
Copy link
Author

Any breakthrough @emawby ? :)

@pratikdhody
Copy link

Any breakthrough @emawby ? :)

FYI @dgsunesen I’m in the process of figuring this out also. For me, it’s only affecting iOS where as Android is working as expected. I’m going to be trying to figure out how to disable the one signal listener as I believe it’s what is causing the issue. Disabling this should allow the expo-notifications one to handle the request. Will report back this week.

@dtyrrell
Copy link

dtyrrell commented Jul 3, 2023

Any breakthrough @emawby ? :)

FYI @dgsunesen I’m in the process of figuring this out also. For me, it’s only affecting iOS where as Android is working as expected. I’m going to be trying to figure out how to disable the one signal listener as I believe it’s what is causing the issue. Disabling this should allow the expo-notifications one to handle the request. Will report back this week.

kinda weird, since for me iOS is working as expected and Android is getting duplicate notifications...

and I'm trying to stop expo from handling notifications when the app is in the background..

@radoam1
Copy link

radoam1 commented Sep 22, 2023

I have the same issue any update or workaround or help with this issue ?

@Klyado
Copy link

Klyado commented Oct 11, 2023

Hi,

Same issue here. Any information / news about this @emawby ?

Thanks for your help.

@ovidb
Copy link

ovidb commented Dec 27, 2023

We also have duplicated notifications in Android.

It goes away for Android if you update to the latest version of the SDK and plugin, however, now for us the build for IOS is breaking in EAS.

I'm trying to figure out if this is really a true positive before posting an issue, but the bottom line is that for us, updating to the versions bellow made the duplicated notification go away.

"react-native-onesignal": "^5.0.4",
"onesignal-expo-plugin": "^2.0.2",

@JohnGeorgiadis
Copy link

We have the same issue on iOS.
"expo-notifications": "~0.28.3",
"onesignal-expo-plugin": "^2.0.2",
"expo": "^51.0.8",

The Notifications.addNotificationResponseReceivedListener from expo-notifications is not firing in ios when I receive a notification from a 3rd service like sendbird. The notifications are coming to the app and I am able to interact with them.

I was also wondering why we cannot just listen to onesignal notifications from Notifications.addNotificationResponseReceivedListener and we need to implement specific onesignal listener OneSignal.Notifications.addEventListener or why onesignal cannot listen to all the notifications coming to the app not just the ones from onesignal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compatibility Issue Help Wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants