I am currently writing react-native for a Chat feature for my app.
I am using Firebase as the mailBox. Since I don't want to save chat data on our database, I decided to save messages to the AsyncStorage, the device database.
So, the steps are like this:
1) User B's device listening to his mailBox changes on Firebase
2) User A send message to User B mailBox on Firebase
3) User B received the new message, because of Firebase listener
4) User B's device save the new message to AsyncStorage
5) User B's device detected changes on AsyncStorage and update the UI of Chat
Come to here, I need a listener to listen to the AsyncStorage changes so that the UI can be updated accordingly.
This come to the topic: Can I add listener or a trigger, like DB trigger in Oracle database, to AsyncStorage?
Also, I would also like to know whether I should save users' messages in my server database. Thanks