Git Product home page Git Product logo

react-native-firebase-messaging's Introduction

React Native Firebase - Messaging

Original Documentation


Original Android implementation uses a broadcast receiver to get notifications and when app is in foreground, emits an event for ReactNative with the data. When the app is in quit or background state, puts the notification into a static hashmap and invokes a headless js service.

When the app is brought to foreground from quit or background state by tapping on a notification in tray, ReactNative module gets the message id from the intent and then checks for the message in the hashmap. If found emits an event when the app is in background, or resolves a promise with the message when the app is in quit state.

If a user opens the app and close it while notificatinos are in tray, resources are released including the hashmap and all notifications are lost. Next time when the user opens the app by tapping a notification, app does not receive the message.

The forked messaging library have removed the hashmap and on notification tap, message is aquired via intent extras and passed to the app.

Steps

  • fork react-native-firebase from https://github.com/invertase/react-native-firebase
  • create a branch from the required tag. this branch was created with the tag @react-native-firebase/[email protected] git checkout -b messaging-6.7.1 @react-native-firebase/[email protected]
  • switch to react-native-firebase-messaging repository and create a branch with the above tag name. ex. 6.7.1
  • copy all from react-native-firebase/packages/messaging folder
  • copy .gitignore from react-native-firebase/.gitignore
  • remove **/version.js from .gitignore file
  • copy devDependencies from react-native-firebaase root package.json
  • modify android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java to remove hashmap
  • modify android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingModule.java to remove dependencies to hashmap
yarn add https://github.com/calceytechnologies/react-native-firebase-messaging#6.7.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.