-
Notifications
You must be signed in to change notification settings - Fork 29
[iOS] onBackgroundEvent doesn't fire when a local notification is recieved #276
Comments
Hi, there's an issue (#146) to document that no delivered event will be received for trigger notifications when the app is in the background which is now noted on the website (https://notifee.app/react-native/docs/events). |
Thank you for quick response, however I can't detect any notification whatsoever. As you can see in the piece of code I've attached to the original message, there're two |
Hi, if you call If you press on that same notification while the app is in the background (but the app is still open), does an event comes through? Also, can you put a console.log in the |
|
thanks. |
I'm waiting for at least something, that could trigger my action in background, and I'm not getting anything. This is a crucial part of the project, which works rather well on Android. Is there any way to detect logging while the app is in the background on iOS? As I've mentioned, I couldn't get anything in terminal. |
Hello! Any updates? |
Hi, I'd recommend tying the demo app here (https://github.com/mikehardy/rnfbdemo) and run There maybe a TODO item to add some debug logging so when this issue comes up, we can say watch for these in the native logs. Do your events fire for actions when your phone is in the foreground? |
@helenaford I've just used this demo repository, and yes, async function onDisplayNotification() {
// Create a channel
try {
const channelId = await notifee.createChannel({
id: 'default',
name: 'Default Channel',
});
const settings = await notifee.requestPermission();
if (settings.authorizationStatus === IOSAuthorizationStatus.DENIED) {
console.log('User denied permissions request');
} else if (
settings.authorizationStatus === IOSAuthorizationStatus.AUTHORIZED
) {
console.log('User granted permissions request');
} else if (
settings.authorizationStatus === IOSAuthorizationStatus.PROVISIONAL
) {
console.log('User provisionally granted permissions request');
}
// Display a notification
const date = new Date(Date.now());
date.setMinutes(6, 0); // scheduled to land in ~one minute
await notifee.createTriggerNotification(
{
title: 'Notification Title',
body: 'Main body content of the notification',
android: {
channelId,
pressAction: {
id: 'default',
launchActivity: 'default',
launchActivityFlags: [AndroidLaunchActivityFlag.SINGLE_TOP],
},
},
},
{timestamp: date.getTime(), type: TriggerType.TIMESTAMP},
);
await notifee.displayNotification();
} catch (e) {
console.log('Failed to display notification?', e);
}
} Then press on Display Notification button in the app and minimize the app, |
Hi, I have the same issues that @eqlion with IOS |
@fciprian42 in my case |
Oh yeah, same than you. |
There's a note in the docs that delivered event for iOS in background is not possible. Maybe we need to add that to the typescript docs as well so it doesn't get lost. Does that help at all? |
@helenaford did we talk about delivered event ? |
Not all events are possible for iOS, and there is an open issue around press action. I can't see in the example above any actions, so there won't be any events. It's important you are as detailed as possible, and describe which events you are trying to listen to. There's also another git issue (#233 (comment)) where I've pasted the log output of the iOS background event listener. |
@helenaford here's my thought process:
|
Any updates/ideas on how to solve the issue? The core principle of our app revolves around being able to somewhat reliably schedule actions that would be done in background. Without it we can't publish our apps. Any thoughts would be highly appreciated. |
Still no updates? We need to provide at least some explanation to our clients and/or solution. |
Sorry i'm still very confused with what event you require for iOS. it is not possible to know when the trigger notification is displayed/received on iOS. |
@helenaford ok, I see. I've got another question: I know it's off-topic, but I don't know where else to ask — we have a question regarding licensing/payment and the support is ignoring our email for 2 weeks straight now. Is there any other way to get in touch with them? Thank you in advance! |
Yeah if you drop me a dm on Twitter (@helenaellieford) or on the invertase discord channel with your email. I can chase that for you |
@helenaford I can't dm you on twitter (I guess you need to follow me for me to be able to message you) and I can't find discord server address anywhere :( |
Ok try it now, my dms should be open |
@eqlion let me know if you can dm me, or you can join the discord with this invite link https://discord.gg/zYvEhf9Wm6 |
@helenaford yes, I posted the message at the discord, thank you. I think I'll close the issue, as this is not related anymore. upd: and I also sent you a pm on twitter, just in case it would be easier for you to find. Thanks again! |
In our project we're trying to use Notifee in production to schedule local notifications (without FCM), which when are received, fire some short action in background via
onBackgroundEvent
. On Android it works somewhat reliably, however on iOS when we received the notification in background nothing fires. I wasn't able to debug it, as there's no logging neither in RN terminal, nor in XCode terminal. If the background task is successful, I would be able to see that, as it fires an external action.If I try to use
onForegroundEvent
(just in case), it is fired when a notification is scheduled for some reason.I've seen #233, but it doesn't really help, as I'm already using the latest version of Notifee, albeit I haven't tried this script.
Versions
iOS: 12.4.5
Android: 10
Notifee: 1.2.1
RN: 0.62.2
The text was updated successfully, but these errors were encountered: