> ## Documentation Index
> Fetch the complete documentation index at: https://docs.a0.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Android FCM Setup

> Set up Firebase Cloud Messaging credentials for Android push notifications

# Android FCM Setup

a0 uses Firebase Cloud Messaging (FCM v1) to deliver push notifications to Android devices. You need two files from Firebase:

| File                             | Purpose                                                                        |
| -------------------------------- | ------------------------------------------------------------------------------ |
| **google-services.json**         | Registers your Android app with Firebase. Injected into the APK at build time. |
| **Firebase service account key** | Private key used by a0's servers to send notifications via the FCM v1 API.     |

## Step 1: Create a Firebase project

If you already have a Firebase project for your app, skip to Step 2.

1. Open the [Firebase Console](https://console.firebase.google.com/)
2. Click **Add project** and follow the setup wizard

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/01-new-firebase-project.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=74cf0b22f79768c38a4b856fec556b60" alt="Creating a new Firebase project" width="1980" height="1282" data-path="images/android-fcm-setup/01-new-firebase-project.png" />
</Frame>

## Step 2: Download google-services.json

This file contains your Firebase project's public configuration and is required for your Android app to connect to Firebase.

1. In the [Firebase Console](https://console.firebase.google.com/), open **Project settings** (gear icon)
2. Under **Your apps**, select your Android app (or click **Add app** → **Android** if you haven't added one yet)
3. Enter your Android package name — this should match the bundle identifier used in your a0 project
4. Click **Download google-services.json**

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/05-setup-google-services-json.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=2d3d4357eacaf878679d6e144673311a" alt="Downloading google-services.json from Firebase Console" width="1600" height="1036" data-path="images/android-fcm-setup/05-setup-google-services-json.png" />
</Frame>

<Note>
  This file contains public-facing identifiers and is safe to commit to your repository. It does **not** contain any private keys.
</Note>

## Step 3: Create a Firebase service account key

The service account key is a private JSON file that authorizes a0's servers to send push notifications on your behalf via the FCM v1 API.

1. In the Firebase Console, open **Project settings** → [**Service accounts**](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk)
2. Make sure **Firebase Admin SDK** is selected

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/02-manage-service-accounts.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=647c6879b0a468509fd5620624af96ee" alt="Firebase Service accounts settings" width="1980" height="1282" data-path="images/android-fcm-setup/02-manage-service-accounts.png" />
</Frame>

3. Click **Generate New Private Key**
4. Confirm by clicking **Generate Key** — a JSON file will download

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/03-generate-key.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=9025c950747eca24b8a79e2198a9545e" alt="Generating a new private key" width="1980" height="1282" data-path="images/android-fcm-setup/03-generate-key.png" />
</Frame>

<Warning>
  Store this file securely. It contains a private key that grants access to send notifications to your app. **Do not** commit it to your repository.
</Warning>

### Using an existing service account

If you already have a Google Cloud service account and want to reuse it for FCM:

1. Open the [IAM Admin page](https://console.cloud.google.com/iam-admin/iam) in Google Cloud Console
2. Find the service account you want to use and click the pencil icon to **Edit Principal**

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/01-iam-admin-page.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=4ce8b42ff47f4020fb21cf520eebd92c" alt="IAM Admin page in Google Cloud Console" width="1980" height="1282" data-path="images/android-fcm-setup/01-iam-admin-page.png" />
</Frame>

3. Click **Add Role** and select **Firebase Cloud Messaging API Admin**

<Frame>
  <img src="https://mintcdn.com/a0dev/mgZ85r1zTikFn1BJ/images/android-fcm-setup/02-add-role-1.png?fit=max&auto=format&n=mgZ85r1zTikFn1BJ&q=85&s=b2ca46b1945aa7f9d86f3e81ecb29293" alt="Adding Firebase Messaging API Admin role" width="1980" height="1282" data-path="images/android-fcm-setup/02-add-role-1.png" />
</Frame>

4. Click **Save**
5. Download a new JSON key for this service account if you don't already have one

## Step 4: Upload to a0

1. Open your project in a0
2. Go to **Project Settings** → **Build Settings** → **Android Credentials**
3. Upload your **google-services.json** file
4. Upload your **Firebase service account** key file
5. Build a new custom APK — the credentials will be included automatically

Both files will show a **Configured** badge once uploaded. You can replace or delete them at any time.

<Info>
  After uploading new credentials, you need to create a new APK build for the changes to take effect. Existing builds will continue using the credentials they were built with.
</Info>

## Helpful links

* [Firebase Console](https://console.firebase.google.com/)
* [Firebase Service Accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk)
* [Google Cloud IAM Admin](https://console.cloud.google.com/iam-admin/iam)
* [FCM v1 API documentation](https://firebase.google.com/docs/cloud-messaging/migrate-v1)
* [Push Notifications guide](/development/push-notifications)
