Skip to main content
SDK Version

Setting up Firebase

Before you can start sending messages to Android, you will have to at least set up a Firebase Cloud Messaging (FCM) project. This is all done via the Firebase Console. This guide walks you through generating the required Service Account JSON file and uploading it to your Actito app settings.

Create a Firebase project

Go to the Firebase console and create a new project. If you already have a Firebase project, you can skip this step.

New project

Check the official Firebase documentation for more information on creating a Firebase project.

Enabling Firebase Cloud Messaging

In Firebase, click on the gear icon next to Project overview and select Project settings. Then, click on the Cloud Messaging tab.

If the Firebase Cloud Messaging API (v1) is not enabled, you will see the following message.

Project settings

Click on the 3-dot menu and go to the Google Cloud Platform page to enable it.

Enabling FCM

Generate a Service Account

In Firebase, go to the Project overview > Project settings > Service accounts tab and generate a new Service Account for the Firebase Admin SDK.

Project settings

Save the Service Account JSON file somewhere safe. You will need it to configure your Actito application.

Upload the Service Account JSON file

This file needs to be uploaded in Actito. Please find the steps to do so here.

Register your app with Firebase

To use Firebase in your Android app, you need to register your app with your Firebase project. Registering your app is often called "adding" your app to your project.

  1. Go to the Firebase Console.
  2. In the center of the project overview page, click the Android icon or Add app to launch the setup workflow.
  3. Enter your app's package name in the Android package name field.
  4. Click Register app.

Register the app

Add a Firebase configuration file

Download and then add your app's Firebase config file (google-services.json) to your codebase:

  1. Click Download google-services.json to obtain your app's Firebase config file.
  2. Place the google-services.json file inside your application and set its location in your app.json file:
{
"expo": {
// more code...

"android": {
"googleServicesFile": "./configuration/google-services.json",
}
}
}

Multiple Firebase projects

If your setup uses multiple Firebase projects, typically for development and production, you can use different Firebase configuration files for each environment. Place the Firebase configuration files in the following locations:

  • Production configuration: <project>/configuration/release/google-services.json
  • Development configuration: <project>/configuration/debug/google-services.json

This approach uses Android's build configuration to determine which configuration file to use. You can read more about this approach in the Android documentation.