Closed ashishmangukiya closed 1 year ago
Hey, have you added the setBackgroundMessageHandler(), in the index.js file?
can you provide more information about the use case, which platform (ios or android)? What's the payload of the remote notification? is it data-only?
@quicksilverr Thank you for the comment.
targetSdkVersion = 33
But I am not using firebase here to receive push notification from server. just local scheduling using createTriggerNotification() method.
Case - 1) Added onBackgroundEvent() in index.js file as per notifee doc. 2) Scheduling a notification using createTriggerNotification() to receive after 10 mins. 3) App is closed now completely, after 10 mins I should receive a push notification but it's not happening. but if I open app after 10 mins then I get the same scheduled notification.
Not receiving if the app is closed.
@ashishmangukiya This might help
https://notifee.app/react-native/docs/android/background-restrictions
Is this for android or iOS?
@helenaford Now I am able to receive notifications even in killed state. the issue was bcz of background restriction
@serveroid I was having this problem when the app was killed. Only on Android. I couldn't get a push, and then when I opened the app all of my pushes would appear at the same time.
If I opened the phones settings and went to --
Settings --> Apps --> 'My App' --> App Battery Usage
then selected Unrestricted, things started working as expected. So Maybe check out the background restrictions and try to get your user to allow your app to run in the background.
Hope that helps.
@serveroid I was having this problem when the app was killed. Only on Android. I couldn't get a push, and then when I opened the app all of my pushes would appear at the same time.
If I opened the phones settings and went to --
Settings --> Apps --> 'My App' --> App Battery Usage
then selected Unrestricted, things started working as expected. So Maybe check out the background restrictions and try to get your user to allow your app to run in the background.
Hope that helps.
Please can u show me ur fcm JSON payload?
@serveroid I was having this problem when the app was killed. Only on Android. I couldn't get a push, and then when I opened the app all of my pushes would appear at the same time.
If I opened the phone settings and went to --
Settings --> Apps --> 'My App' --> App Battery Usage
then selected Unrestricted, things started working as expected. So Maybe check out the background restrictions and try to get your user to allow your app to run in the background.
Hope that helps.
I don't think that's an good idea to display prompt for disabling the battery optimization for our app to each user. then how come whatsapp, snapchat etc sending notifications with battery atomization ON?
Agreed, I'm curious as to how apps like whatsapp and snapchat are able to send notifications in a killed state with battery optimization on
Bug
Library version - @notifee/react-native - 7.3.0 react-native - 0.67.3
Issue -
I have added onBackgroundEvent() in index.js file at top but notification not showing when app is killed. notification is working when app is in background (not killed) or in running state.
Can anyone help on this? Am I missing any configuration to receive notification when app is killed?