-
Notifications
You must be signed in to change notification settings - Fork 233
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
[iOS] onBackgroundEvent EventType Press, Dismissed or Delivered doesn't work #1076
Comments
On [Android], the "press" event type also does not trigger when the phone is locked. |
also experiencing a similar issue |
Any solution here? |
check #616 (comment). looks like onBackgroundEvent is not like what we think about. use onForegroundEvent.
check #621 (comment). It's mostly like reactContext is null. |
@Eclipses-Saros Thank you for your response. Using foregroundEvent does not resolve my issue. I still can't capture the event type on iOS. Could you provide more explanation on how to achieve this? I'm also a bit confused by the documentation. It suggests using onForegroundEvent to handle cases where the user interacts with a notification, but that only applies when the app is in the foreground (visible). In my case, the app is either in the background or the phone is locked. When the user clicks the notification, the app opens, and from what I understand, I need to use onBackgroundEvent to handle the user's actions (events). |
first of all,
you mean, "the documentation says using
- (void)sendNotifeeCoreEvent:(NSDictionary *_Nonnull)eventBody {
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (RCTRunningInAppExtension() ||
[UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
[self sendEventWithName:kReactNativeNotifeeNotificationBackgroundEvent body:eventBody];
} else {
[self sendEventWithName:kReactNativeNotifeeNotificationEvent body:eventBody];
}
});
} here is some code from notifee iOS native module code. when you press notification, native module call in theory, press notification in the background or dead should be recognize as 'background' event... but sadly pressing notification makes app status into foreground, then called native function. that's the why + however, if you meaning "I can't receive any press events from notification", there are another problems that I didn't know. in that case, I also need investigate this issue further more. |
@Eclipses-Saros thanks for detailed explanation, now I understand. However, my issue is that I'm not receiving any notification press events at all [on iOS, android is working just fine]. Even when the app transitions from background to the foreground, the event doesn't seem to trigger. Do you have any thoughts on what could be causing this? |
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?
Thank you for your contributions. |
I think if this PR gets merged, the issue will be resolved. |
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?
Thank you for your contributions. |
Still an issue. This happens only on IOS & on some Android models (One Plus). It works fine on Samsung & Vivo Android phones.
|
Indeed - continued appreciation for the patience, I'm through all the react-native new architecture issues, a regression of apple-authentication on iOS simulators and some subtle react-native-firebase issues. Working on Apple dev account provision for a repro + test app here and then this whole thing about iOS handlers is going to get the attention it really needs... |
The onBackgroundEvent works on Android, but not on iOS. The only event type that works for iOS is 7 (TRIGGER_NOTIFICATION_CREATED). Here is how I've implemented it:
In App.tsx I'm expecting the user action this way:
Please help!
The text was updated successfully, but these errors were encountered: