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

[Bug]: Onesignal does not show notification when app in foreground android #1670

Open
2 of 3 tasks
AFDHAL2009 opened this issue Mar 21, 2024 · 4 comments
Open
2 of 3 tasks

Comments

@AFDHAL2009
Copy link

What happened?

Hello, i have issue when app in foreground the notif come by silienty , i have installed latest version 5.1.0,but in background works fine .notif come with sound ,
I dont know if this feature is deleted from this version or no,Note that 4.5.2 works fine .(foreground et backaground)
image

 OneSignal.Notifications.requestPermission(true);
  // Method for listening for notification clicks
  OneSignal.Notifications.addEventListener('click', event => {
    console.log('OneSignal: notification clicked:', event);
  });
  OneSignal.Notifications.addEventListener('foregroundWillDisplay', event => {
    console.log('OneSignal: notification foreground:', event);
  });

Steps to reproduce?

1.Install version 5.1.0

What did you expect to happen?

there is no information as notification coming only bye console

React Native OneSignal SDK version

0.70.6

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

OneSignal: notification foreground: {"notification": {"actionButtons": undefined, "additionalData": undefined, "androidNotificationId": 1751867923, "bigPicture": undefined, "body": "jhjh", "collapseId": undefined, "fromProjectNumber": "799121433974", "groupKey": undefined, "groupMessage": undefined, "largeIcon": undefined, "launchURL": undefined, "ledColor": undefined, "lockScreenVisibility": 1, "notificationId": "1801dfec-3583-4000-a290-586f0cc26613", "priority": 5, "rawPayload": "{\"google.delivered_priority\":\"normal\",\"google.sent_time\":1711023883965,\"google.ttl\":259200,\"google.original_priority\":\"normal\",\"custom\":\"{\\\"a\\\":{},\\\"i\\\":\\\"1801dfec-3583-4000-a290-586f0cc26613\\\"}\",\"pri\":\"5\",\"vis\":\"1\",\"from\":\"799121433974\",\"alert\":\"jhjh\",\"title\":\"vh\",\"google.message_id\":\"0:1711023884002345%6cef8906f9fd7ecd\",\"google.c.sender.id\":\"799121433974\"}", "smallIcon": undefined, "smallIconAccentColor": undefined, "sound": undefined, "title": "vh"}}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@RafikMk
Copy link

RafikMk commented Mar 21, 2024

I'm also experiencing this issue with react-native-onesignal version 5.0.1, where the foregroundWillDisplay event is triggered without actually receiving any notifications when the app is in the foreground. Interestingly, this wasn't an issue in the previous version 4.5.1, where notifications were received as expected under similar conditions. It seems like there might be a change or regression in handling foreground notifications between these versions. Has anyone found a workaround or a fix for this?

@monisa-alvi08
Copy link

Facing the same issue on iOS as well.

@samsnori
Copy link

Just noticed this issue which is similar to this: #1672 for me the fix I posted there works for Android.

@marcell6
Copy link

marcell6 commented Nov 8, 2024

Hi @AFDHAL2009 and everyone who seen this, I fix it by mark/comment line here

Thank you

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

5 participants