# Firebase App Setup

## Firebase App

First, go to the [<mark style="color:blue;">Firebase console</mark>](https://console.firebase.google.com/), log in, and select your existing project or add a new project.

Within your project click the gear icon next to the `Project Overview` section in the sidebar and select `Project Settings`.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FPiGbpFE4wU4qJf1StTGA%2FScreenshot%202022-12-16%20at%2011.16.08%20AM.png?alt=media&#x26;token=d0429847-3759-4014-9538-dfc99048ff3c" alt=""><figcaption></figcaption></figure>

Next, navigate to the `Cloud Messaging` tab.&#x20;

### Firebase Cloud Message API (V1) Setup

At Firebase Cloud Messaging API (V1) make note of the `Sender ID` value. This will be used later in this process.

Next, click on the link to Manage Service Accounts and the Google Cloud console will open in a new tab.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2F5R1UOtOltAEfi6rHtj9w%2Fimage.png?alt=media&#x26;token=bba03efd-3cba-46f0-ba46-702e26c68a7b" alt=""><figcaption></figcaption></figure>

#### Create Cloud Messaging Role

In the `IAM & Admin` sidebar, click on Roles.

Click the `+ Create Role` button and fill in the following fields:

* Title: `Cloud Messaging Notification Create`
* ID: `CloudMessagingNotificationCreate`
* Role launch stage: `General Availability`

Next, click the `+ Add Permissions` button, filter down permissions to the text: `Cloud Messaging Notification Create` . Select the checkbox for that permission and click the `Add` button.

{% hint style="warning" %}
If you can't find **Cloud Messaging Notification Create** when searching, instead search for **Firebase Cloud Messaging API Admin** and, after selecting it, look for the **cloudmessaging.messages.create**  permission, click the checkbox, and click **Add**.
{% endhint %}

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2F6wZedMVImXZ1rykZM55Q%2FScreenshot%202025-03-21%20at%2010.18.50%E2%80%AFAM.png?alt=media&#x26;token=2c2e8059-4794-4bc9-88b1-8b562e823400" alt=""><figcaption></figcaption></figure>

Once you've added the permission click the `Create` button to finish creating the role.

#### Create Cloud Messaging Service Account

In the IAM & Admin sidebar, click on Service Accounts.

Click the `+ Create Service Account` button and fill in the service account name field as `Cloud Messaging` and then click the `Create and Continue` button.

From the `Select Role` dropdown filter down to `Cloud Messaging Notification Create` and choose the role we created in the previous step and then click the `Continue` button.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FIfMwy8frlmngxPUdGGtE%2FScreenshot%202023-07-17%20at%2010.54.26%20AM.png?alt=media&#x26;token=c2fedc77-8cf0-4408-9f6f-c2d10efb02ca" alt=""><figcaption></figcaption></figure>

Next, click the `Done` button to be returned back to the Service Accounts page.

At the Service accounts page, click on the email address link of the `Cloud Messaging` service account. On the following page, navigate to the `Keys` tab and click `Add Key -> Create New Key`.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2F5DHOyGQv0XLnGMzpBIme%2FScreenshot%202023-07-17%20at%2010.59.22%20AM.png?alt=media&#x26;token=074ea6f0-46eb-40cb-a541-3681806539f7" alt=""><figcaption></figcaption></figure>

Choose the `JSON` Key type and click the `Create` button.

After clicking the `Create` button a Service Account JSON file will be downloaded to your computer. This is the file that you will use in the next step when setting up the integration in the platform.

#### Enable Integration in Platform

Log into the platform, navigate to the `Settings` page, and locate the `Send Integrations` section.

From here, click the `Edit` button in the `Send Integration` header, enable the `Native` switch under the `Android` heading and:

1. Enter the Firebase `Sender ID`  that you retrieved earlier.
2. Click the `Upload your Service Account JSON File` area and choose the file your downloaded in the previous step.
3. Click the `Submit` button

![](https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2F2q0qxtc5lBHge4dRqwEU%2FScreenshot%202023-07-17%20at%2011.18.22%20AM.png?alt=media\&token=23b05510-7db1-4e50-ad71-d0b9cb75f46f)

If everything was entered correctly you should now see a section underneath `Send Integrations` that shows an active Android Native integration.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FSsCxjuCNzufFNGMwfg1f%2FScreenshot%202022-12-16%20at%2011.32.09%20AM.png?alt=media&#x26;token=2a7567d0-4842-4d8b-bed2-a7d66a40442e" alt=""><figcaption></figcaption></figure>

Once this step is complete you can continue with implementation of the SDK into your app

### Cloud Messaging API (Legacy / Deprecated)

{% hint style="danger" %}
As of June 20, 2023, [Google has deprecated](https://firebase.google.com/support/faq#fcm-23-deprecation) the legacy FCM APIs and sending messages using them will no longer function starting June 2024.&#x20;

As-such we recommend using the V1 instructions above to avoid interruptions in your future notification delivery.
{% endhint %}

If the `Cloud Messaging API (Legacy)` is marked as disabled you will need to enable it.&#x20;

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FVE8SP3HyrzBeBds5WQ4z%2FScreenshot%202022-12-16%20at%2011.23.37%20AM.png?alt=media&#x26;token=defb25e2-6461-444d-9f03-959aa9d489f9" alt=""><figcaption></figcaption></figure>

Follow these steps:

* Click on the 3 dots next to `Cloud Messaging API (Legacy)`
* Select `Manage API on Google Cloud Console`
* Click `Enable` on the tab that opened
* After the page reloads you can close this tab and return to the Firebase Console
* On the Firebase Console tab refresh the page to reflect the enabled API

Once the legacy API has been enabled the `Server Key` and `Sender ID` will be displayed. Copy down each of these values and proceed to the Pushly platform.

Log into the platform, navigate to the `Settings` page, and locate the `Send Integrations` section.

From here, click the `Edit` button in the `Send Integration` header, enable the `Native` switch under the `Android` heading and:

1. Enter the Firebase `Sender ID`
2. Choose `Legacy` from the pill selection
3. Enter the `Server Key`
4. Click the `Submit` button

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FShCdc1U0MnZCiWxJo7L2%2FScreenshot%202022-12-16%20at%2011.29.24%20AM.png?alt=media&#x26;token=2885aa8c-23eb-4b3a-855f-696681ffad02" alt=""><figcaption></figcaption></figure>

If everything was entered correctly you should now see a section underneath `Send Integrations` that shows an active Android Native integration.

<figure><img src="https://810756845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lry9Z27iWOZyQEGAgY7%2Fuploads%2FSsCxjuCNzufFNGMwfg1f%2FScreenshot%202022-12-16%20at%2011.32.09%20AM.png?alt=media&#x26;token=2a7567d0-4842-4d8b-bed2-a7d66a40442e" alt=""><figcaption></figcaption></figure>

Once this step is complete you can continue with implementation of the SDK into your app
