snappreneur
  • Introduction
  • Quick Start Guide
  • Introduction
  • Features
  • Setting Up the environment (Critical)
  • Prerequisites
  • Customization and Installation
  • Push Notifications and Firebase Cloud Functions
  • Final Steps
  • Auxiliary Service
Powered by GitBook
On this page

Push Notifications and Firebase Cloud Functions

PreviousCustomization and InstallationNextFinal Steps

Last updated 7 years ago

The final step is to write a cloud function to listen for database activity. To start, make sure that you have installed the Firebase CLI and login.

$ npm install -g firebase-tools $ firebase login

Then cd into your project directory and run:

$ firebase init

When it prompts you to install node modules return yes. Once the script completes, in your React Native project you should now have a new folder: functions

Open < Firebase_functions_pushNotification_Script> and copy <index.js> and replace the <index.js> inside the functions folder created.

Then run the following commands:

$ cd /<yourprojectdirectory>/ $ firebase deploy

This uploads your function to Google’s servers.

And check the logs too for any activity: