I'm trying to build a react native app that includes chat, I'm using realm for storing my data on the device, and FCM to get a remote notification with 'react-native-firebase'.
I would like to know if there is any way that I can save the data of the remote notification to realm without entering the app or to the notification.
I know that Whatsapp does that - when you are connected to the internet and you get new messages or images and even if Whatsapp app is close, they saved the date to their local db.
I tried to do that with 'react-native-firebase'
this.messageListener = firebase.messaging().onMessage(message => {
console.log(JSON.stringify(message));
});
Or with 'react-native-push-notification'
PushNotification.configure({
// (required) Called when a remote or local notification is opened or received
onNotification(notification) {
console.log("NOTIFICATION", notification);
notification.finish(PushNotificationIOS.FetchResult.NoData);
},
Without any success- when i open the app by clicking on the icon, they aren't triggered