Open shivenmian opened 3 years ago
Also, just wanted to confirm:
There is no need of using rnfirebase for setting up push notifications right? I think I saw in one of the past issues that it's been integrated into this library.
Is remote notifications the right way of going about this? I'm specifically talking about my intended feature of having the notifications come up when the application is closed. I think people some also use 'data-only' notifications to wake up the app and then use local notification to show the notification, but remote notifications should serve the same purpose right?
Thanks in advance for your help!
Hi,
How NotificationController.configureNotification()
is called ?
Refer to the documentation:
DO NOT USE .configure() INSIDE A COMPONENT, EVEN App If you do, notification handlers will not fire, because they are not loaded. Instead, use .configure() in the app's first file, usually index.js.
Regards,
@Dallas62 I am trying suggested workout: use data-only message to wake up the app, then with onNotification event show a local notification. With a data only message app is waking but on the first time local notification is not firing, only on second and after messages showing with local notification. Is this a expected behavior on ios? Is there a way to wake up the app with first message and use it also on showing a local notification?
Hi,
How
NotificationController.configureNotification()
is called ?Refer to the documentation:
DO NOT USE .configure() INSIDE A COMPONENT, EVEN App If you do, notification handlers will not fire, because they are not loaded. Instead, use .configure() in the app's first file, usually index.js.
- RNFirebase can be used for remote notifications and this library for triggering local notification.
- using data-only to trigger a local notification is a normal use case.
Regards,
Hello @Dallas62 , the attached sample code in the git repo itself is not following the documentation. The Config is called in App. I am also facing an issue when a remote notification opens the app, but the onNotification is not triggered.
Hi @vinayjags
The exemple project doesn't provide something called "NotificationController".
And in the example project and in an other issue, your comment has been answered: No, .configure()
is not called inside the App
component, in the exemple project.
@Dallas62 thanks for the response. Sorry my bad. But the problem is that, I am using redux and Redux saga to sync my fcm token to server. now with this approach, the app cannot access the redux store which is needed to sync the token. Not sure if this is related to the library.. just wanted to make sure, I am not doing something.
@Dallas62 Thanks for the reply.
I checked up rnfirebase and I'm trying to use that for data-only notification. Would I need a separate server of my own to trigger firebase to send the app a data-only notification to wake the app up? Or can I get firebase to send the app a data-only notification within the app logic itself?
The readme says that this library can be used for "remote notification". I assumed that "remote notification" involved communicating with the Firebase server for getting notifications. But does this remote notification not wake up the app (like data-only notification)? I'm just trying to understand the difference between data-only and remote notifications.
@Dallas62 what do you think? ^
Bug
I'm building an application wherein notifications can come up at random times of the day. Since local notifications wouldn't work when the application is closed, I'm using remote push notifications solely for this purpose (i.e have the notifications come up even if the application is closed).
For remote push notifications I'm using this library and I have registered my app on Firebase (also enabled push notification capability for iOS) and followed the steps on this repo, however it still isn't working. I just checked again I see that onRegister and onNotification are not being called, so I don't think the remote notification is being fired. Also, in the cloud messaging section of Firebase console, it does not report any activity.
Environment info
react-native info
output:Library version: 6.1.3
Steps To Reproduce
The notification code is below (I have blanked out the
senderID
but have added it in the code):Describe what you expected to happen:
Reproducible sample code