Skip to content

Instantly share code, notes, and snippets.

@amjadbouhouch
Last active January 8, 2022 11:01
Show Gist options
  • Save amjadbouhouch/b2d7e4c6552735650674ebad9d1e9996 to your computer and use it in GitHub Desktop.
Save amjadbouhouch/b2d7e4c6552735650674ebad9d1e9996 to your computer and use it in GitHub Desktop.
Notifee

Receiving Messages FCM

  1. ForegroundState
// any component you want
useEffect(() => {
  const unsubscribe = messaging().onMessage(async (message) => {
    // work
  });
  return unsubscribe;
}, []);
  1. Background state
    This is in Android
// outside your app as register background handler inside => index.js
messaging().setBackgroundHandler(async () => {
  // work
});

This is in IOS, Manually insert it

    function isHeadless(({isHeadless}) => {
        if(isHeadless){
            return null;
        }
        return <App />
    })

Notifee handler notifee.app

Links:

  1. https://www.youtube.com/watch?v=gOZuD2SVHBo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment