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]: OneSignal.Default.NotificationWillShow delegate not invoked #386

Open
1 task done
tele-bird opened this issue Apr 25, 2024 · 2 comments
Open
1 task done

Comments

@tele-bird
Copy link

How can we help?

Immediately after invoking OneSignal.Default.Initialize(), we wireup delegates for NotificationWillShow and NotificationOpened, however I'm only seeing NotificationOpened being invoked when I send test push notifications to my device from the portal. Shouldn't I see NoficationWillShow invoked first (and then NotificationOpened when the user taps on the notification)? This happens on both Android and iOS. Am I doing something wrong?

public void Initialize(string appId) { #if DEBUG OneSignal.Default.LogLevel = LogLevel.VERBOSE; #endif OneSignal.Default.Initialize(appId); OneSignal.Default.NotificationWillShow += OneSignal_NotificationWillShow; OneSignal.Default.NotificationOpened += OneSignal_NotificationOpened; }

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tele-bird
Copy link
Author

I have attached our debug log. At the bottom of the log, you can see that my delegate for the NotificationOpened event was invoked. So this means that the notification appears without first invoking the NotificationWillShow delegate.

debug_log.txt

@tele-bird
Copy link
Author

tele-bird commented Apr 26, 2024

After some experimentation, it seems that the NotificationWillShow delegate only gets invoked when the app is already running and is in the foreground at the moment that the push notification is received. Is this the intended behavior for that delegate? What I need is a delegate that gets invoked every time a notification is received. I want to use it to decide whether the notification will be shown on-screen. Does such a thing exist? Using the latest version 4.3.5 of your package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant