> For the complete documentation index, see [llms.txt](https://help.twinr.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.twinr.dev/push/firebase-push-notification/firebase-setup.md).

# Firebase Setup

Create a Firebase project and generate the three files Twinr needs for push notifications and analytics.

Push notifications and Firebase Analytics both run on **Firebase**, Google's app platform. Setting it up means creating one project and generating up to three files from it.

You do this once. The files are shared across features — upload a file under Push and it appears as already uploaded under Analytics, and the other way round.

### What you will generate

<table><thead><tr><th width="260">File</th><th width="130">Platform</th><th>Needed for</th></tr></thead><tbody><tr><td><code>google-services.json</code></td><td>Android</td><td>Push notifications, Firebase Analytics</td></tr><tr><td><code>GoogleService-Info.plist</code></td><td>iOS</td><td>Push notifications, Firebase Analytics</td></tr><tr><td>Service account key</td><td>Both</td><td>Push campaigns sent from <a href="https://help.twinr.dev/push/overview.md">Engage</a></td></tr></tbody></table>

{% hint style="info" %}
**Google Sign-In does not use these files.** It needs three OAuth client IDs from Google Cloud Console instead — see [Google Sign-In](https://help.twinr.dev/native-integrations/google-sign-in.md).
{% endhint %}

### Before you begin

Firebase needs your app's identifiers, and they must match Twinr exactly.

<table><thead><tr><th width="300">You need</th><th>Where to find it</th></tr></thead><tbody><tr><td><strong>Android package name</strong></td><td><a href="https://help.twinr.dev/app-publishing/publishing-to-the-google-play-store/setup-android-signing-information.md">Setup Android Signing Information</a></td></tr><tr><td><strong>iOS bundle ID</strong></td><td><a href="https://help.twinr.dev/app-publishing/publishing-to-the-apple-app-store/create-your-apple-bundle-id.md">Create Your Apple Bundle ID</a></td></tr></tbody></table>

Both look like `com.yourcompany.yourapp`.

{% hint style="warning" %}
**Copy and paste these values — do not type them.** Firebase accepts whatever you enter and produces config files that upload without complaint. If the identifier is wrong by a single character, notifications simply never arrive, and nothing anywhere tells you why. This is the most common setup failure.
{% endhint %}

***

## 1. Create a Firebase project

{% stepper %}
{% step %}

### Open the Firebase console

Go to [console.firebase.google.com](https://console.firebase.google.com/) and sign in with a Google account.

{% hint style="info" %}
Use a company account rather than a personal one. This project holds your app's messaging and analytics; if it sits in an individual's account and they leave, recovering it is difficult.
{% endhint %}
{% endstep %}

{% step %}

### Create the project

Click **Create a project**, enter a name — your app's name is the obvious choice — and continue.
{% endstep %}

{% step %}

### Choose whether to enable Google Analytics

Firebase offers Google Analytics during setup.

Enable it if you plan to use [Firebase Analytics](https://help.twinr.dev/native-integrations/firebase-analytics.md). Skip it if you only want push notifications — you can turn it on later.
{% endstep %}

{% step %}

### Open Project settings

Once the project is created, click the gear icon beside **Project Overview** and choose **Project settings**.

This is where every file in this guide comes from.
{% endstep %}
{% endstepper %}

***

## 2. Create the Android file

`google-services.json` connects your Android app to the Firebase project.

{% stepper %}
{% step %}

### Add an Android app

In **Project settings**, scroll to **Your apps** and click the **Android** icon.
{% endstep %}

{% step %}

### Enter your package name

<table><thead><tr><th width="310">Field</th><th>What to enter</th></tr></thead><tbody><tr><td><strong>Android package name</strong></td><td>Your Twinr Android package name, pasted exactly.</td></tr><tr><td><strong>App nickname</strong></td><td>Optional. A label used only inside Firebase.</td></tr><tr><td><strong>Debug signing certificate SHA-1</strong></td><td>Leave empty. Twinr does not require it.</td></tr></tbody></table>

Click **Register app**.

{% hint style="danger" %}
The package name **cannot be changed** after the app is registered. If you get it wrong, register a second Android app with the correct name — an unused one does no harm.
{% endhint %}
{% endstep %}

{% step %}

### Download google-services.json

Click **Download google-services.json**.

Firebase then shows SDK installation instructions. **Skip them** — they are for developers adding Firebase to code by hand. Twinr handles that for you.
{% endstep %}

{% step %}

### Upload it to Twinr

Open **Push → Firebase Notifications** or **Analytics → Firebase Analytics**, click **Upload google-services.json**, then **Save as draft**.
{% endstep %}
{% endstepper %}

***

## 3. Create the iOS file

`GoogleService-Info.plist` connects your iOS app to the same Firebase project.

{% stepper %}
{% step %}

### Add an iOS app

In **Project settings → Your apps**, click the **iOS+** icon.
{% endstep %}

{% step %}

### Enter your bundle ID

<table><thead><tr><th width="310">Field</th><th>What to enter</th></tr></thead><tbody><tr><td><strong>Apple bundle ID</strong></td><td>Your Twinr iOS bundle ID, pasted exactly.</td></tr><tr><td><strong>App nickname</strong></td><td>Optional. A label used only inside Firebase.</td></tr><tr><td><strong>App Store ID</strong></td><td>Leave empty. It is not needed here.</td></tr></tbody></table>

Click **Register app**.

{% hint style="danger" %}
The bundle ID **cannot be changed** after the app is registered, exactly as with Android.
{% endhint %}
{% endstep %}

{% step %}

### Download GoogleService-Info.plist

Click **Download GoogleService-Info.plist**.

Skip the Xcode and SDK steps that follow.
{% endstep %}

{% step %}

### Upload it to Twinr

Open **Push → Firebase Notifications** or **Analytics → Firebase Analytics**, click **Upload GoogleService-Info.plist**, then **Save as draft**.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
**Add both platforms, even if you only ship one today.** It costs nothing, and it means the other build works the day you decide to release it instead of sending you back here.
{% endhint %}

***

## 4. Create the service account key

The two config files let your app **receive** notifications. Sending campaigns from [Engage](https://help.twinr.dev/push/overview.md) needs one more file: a **service account key**, which authorises Twinr to send on your behalf.

{% hint style="info" %}
Only required if you run push campaigns from Engage. Push notifications you send yourself from the Firebase console work without it.
{% endhint %}

{% stepper %}
{% step %}

### Open the Service accounts tab

In **Project settings**, select the **Service accounts** tab.
{% endstep %}

{% step %}

### Generate a private key

Click **Generate new private key**, then confirm.

A `.json` file downloads immediately.
{% endstep %}

{% step %}

### Store it safely

{% hint style="danger" %}
**This file is a credential, not a config file.** Anyone holding it can send notifications to your app's users. Firebase shows it once and cannot show it again — store it somewhere safe, never commit it to a repository, and never put it on a web page.
{% endhint %}
{% endstep %}

{% step %}

### Upload it to Twinr

Open **Push → Firebase Notifications**, click **Upload secret key** under **Firebase secret key**, then **Save as draft**.

If Twinr rejects the file, it is not a valid service account key — generate a fresh one rather than reusing `google-services.json`, which is a different file.
{% endstep %}
{% endstepper %}

***

## Where the files are used

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Push notifications</strong></td><td>Both config files, plus the service account key for Engage campaigns.</td><td><a href="https://help.twinr.dev/push/firebase-push-notification/enable-push-notification.md">Enable Push Notification</a></td></tr><tr><td><strong>Firebase Analytics</strong></td><td>Both config files.</td><td><a href="https://help.twinr.dev/native-integrations/firebase-analytics.md">Firebase Analytics</a></td></tr></tbody></table>

## Frequently asked questions

<details>

<summary>Do I need a paid Firebase plan?</summary>

No. The free Spark plan covers push notifications and analytics for most apps.

</details>

<details>

<summary>I already uploaded a file for one feature. Do I upload it again for the other?</summary>

No. `google-services.json` and `GoogleService-Info.plist` are shared. Upload either one under Push and it shows as uploaded under Firebase Analytics, and the other way round.

</details>

<details>

<summary>I lost a config file.</summary>

Download it again from **Project settings → Your apps**. Config files are not secrets and can be downloaded as often as you like.

The service account key is different — Firebase cannot show it again. Generate a new one and upload that.

</details>

<details>

<summary>Can I use a Firebase project I already have?</summary>

Yes, provided you add apps matching your Twinr bundle ID and package name. A project created for a website or a different app will not have them.

</details>

<details>

<summary>I changed my package name or bundle ID in Twinr.</summary>

Register a new app in Firebase with the new identifier, download its config file, and upload that. The old file points at the old identifier and stops working.

</details>

<details>

<summary>Notifications arrive on Android but not iOS.</summary>

Check that an iOS app is registered in the same Firebase project and that `GoogleService-Info.plist` came from it. A `.plist` from a different project uploads normally and never delivers.

</details>
