# Push Notifications and Firebase Cloud Functions

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.

{% embed url="<https://drive.google.com/open?id=1PBwKOsuj6IBOtoYhLpOaMPjkuMuMuJnb>" %}

And check the logs too for any activity:

{% embed url="<https://drive.google.com/open?id=1LdX4mcu7NBVSWKrve4Tx5lAH7rcyxrVk>" %}
