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

onForegroundEvent triggered with app in background/closed #136

Closed
7patricia opened this issue Mar 5, 2021 · 16 comments
Closed

onForegroundEvent triggered with app in background/closed #136

7patricia opened this issue Mar 5, 2021 · 16 comments

Comments

@7patricia
Copy link

Hi!

The following behaviour is happening to me: I call displayNotification method, with my app in foreground, the notification is displayed but I don't press it and instead I send the app to background. Then, I go to the notification center and press the notification. As per the documentation, I expected an onBackgroundEvent to be triggered, but instead I am getting an onForegroundEvent. This happens even if I completely close the app and only then press the notification.

I can reproduce this behaviour both in my app and on @mikehardy 's demo project, only in iOS. Android seems to be triggering the correct events.

@mikehardy
Copy link
Contributor

Hi there! Thanks for checking with the demo script as well, gives me an immediate repro :-). I have a separate issue I'm investigating right now with regard to events triggering invertase/react-native-notifee#233 so I'm in reproduction mode on events right now, hopefully will have more information today

@helenaford
Copy link
Member

This is quite a common issue I think with apple and notifications but I can see how we can resolve this. As the 'PRESS' event is triggered, the app transitions from an inactive -> active, we don't get a heads up that it's from the background, but we can treat it like it is.

If the app is already in the foreground, the state will be active.

@sshapoval
Copy link

Hello! I have the same issue...any updates? Thanks!

@paperbunny
Copy link

Hey @mikehardy! Any ETA on this ?

@divvyadmin
Copy link

divvyadmin commented Jun 25, 2021

I am also experiencing this. Can we get an eta?
BTW, thanks for all the awesome work you do!

@divvyadmin
Copy link

divvyadmin commented Jun 25, 2021

FYI I tried out the changes in invertase/react-native-notifee#280 with no change in behavior, which for me means pressing a local notification made by notifee does not trigger any notifee listeners

@helenaford
Copy link
Member

helenaford commented Jun 28, 2021

@divvyadmin thanks for taking the time for trying it out - I really appreciate it. But, sadly invertase/react-native-notifee#280 right now is untestable until the binaries/internal lib on the branch are updated too.

It's still draft because there's an issue where although it does make the correct listener fire i.e. the onBackgroundEvent it was still only firing when the app is in the foreground. This is because we have a slight delay to make sure the React Native side is ready.

Having said that, if events go through fine without this delay for all app states (foreground/background/quit), we can merge it.

I will release an alpha version which you can pull down and try out in the next few days. This worked well when we released a major Android feature this month and we had feedback from the community while we were testing.

@divvyadmin
Copy link

divvyadmin commented Jun 28, 2021

Ok, actually my issue is related, but different. We are getting the forground listener triggered while the app is in the background, but the real issue we are having is that the listener is sometimes not getting triggered at all (you click the notification and the app opens, but absolutely nothing else happens)

This is ios only - Android is working as expected.

I have created another issue here for my specific problem
Thank you!

@helenaford
Copy link
Member

@divvyadmin thanks, I've replied to invertase/react-native-notifee#333.

@helenaford
Copy link
Member

Alpha release is now published yarn add @notifee/react-native@alpha to install version 1.11.0-alpha.0

@systemride
Copy link
Contributor

Hello! We are having this issue as well - any update on ETA for this?

@Salakar Salakar transferred this issue from invertase/react-native-notifee Sep 24, 2021
@github-actions
Copy link

github-actions bot commented Dec 6, 2022

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2022
@illi-homz
Copy link

I have the same problem

@VariabileAleatoria
Copy link

Why is this issue closed?
I'm still facing it.

{
    "@notifee/react-native": "^7.8.2",
    "@react-native-firebase/app": "^19.0.1",
    "@react-native-firebase/messaging": "^19.0.1"
}

On ios, when the app is in background and I click a notification, onForegroundEvent gets triggered, while onBackgroundEvent is ignored.

This is really annoying because I need to handle the two events in a different way but there is no way to distinguish them on ios

@lemagnetic
Copy link

same problem here

{
    "@react-native-firebase/app": "^19.0.0",
    "@notifee/react-native": "^7.8.2",
    "@react-native-firebase/messaging": "^19.0.0",
    "react-native": "0.70.15"
}

why onForegroundEvent event is gets triggered when apps launch?

@markalanevans
Copy link
Contributor

Is this project dead? There has been no releases since Dec 2023?

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

No branches or pull requests