javascriptreactjsfirebasereact-nativereact-native-webrtc

React-Native - How is it possible that when I close an app like messenger I can still receive incoming call notifications from others


I am building an app like Messenger, everything works normally like sending messages, receiving messages, video calling. the technologies i use are react-native, reactJS, socket.io, nodeJS, react-native-webrtc

I wonder how can when I close an app like the messenger I can still receive incoming call notifications from other people. I'm studying firebase notification and react-native-background-timer but it doesn't seem to work the way I want it to

Has anyone had a problem like this and have an answer, please let me know Have a nice day guys <3


Solution

  • In react native firebase there are two types of notifications "background" and "foreground".

    Foreground Notifications:

    A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. Foreground services must display a Notification. Foreground services continue running even when the user isn't interacting with the app.

    When you use a foreground service, you must display a notification so that users are actively aware that the service is running. This notification cannot be dismissed unless the service is either stopped or removed from the foreground.

    Background Notification:

    A background service performs an operation that isn't directly noticed by the user. For example, if an app used a service to compact its storage, that would usually be a background service.

    You want to follow there Documentation to apply push notifications in react native.