Android Firebase Credentials

developer

Android Firebase Credentials

Step-by-step guide for setting up Firebase Cloud Messaging (FCM) credentials for Android push notifications.

To send push notifications to Android apps, Hood uses Firebase Cloud Messaging (FCM). This guide walks you through creating a Firebase project, generating the required credentials, and uploading them to Ocamba.

Tip
Firebase credentials are required for Android push notifications. Complete this setup before integrating the Hood SDK into your Android app.

Requirements

Before starting, ensure you have:


Step 1: Create a Firebase Project

1.1 Access Firebase Console

  1. Go to the Firebase Console
  2. Sign in with your Google account
  3. Click Create a new Firebase project (or select an existing project)

Firebase Create or Select Project

1.2 Configure Your Project

  1. Enter a project name (e.g., “My App Push Notifications”)
  2. Choose whether to enable Google Analytics (optional)
  3. Click Create project
  4. Wait for the project to be created, then click Continue


2.1 Register Your App

  1. In the Firebase Console, click Add app and select the Android icon

Add Android App

  1. Enter your Android package name (must match your app’s applicationId in build.gradle)

Register App

  1. Optionally add:
    • App nickname — A friendly name for your app
    • Debug signing certificate SHA-1 — Required for some Firebase features
  2. Click Register app

2.2 Download Configuration File

  1. Download the google-services.json file
  2. Place it in your Android project’s app/ directory

Download google-services.json

⚠️ Warning: The google-services.json file contains sensitive configuration. Do not share it publicly or commit it to public repositories.

2.3 Add Firebase SDK

Follow the on-screen instructions to add the Firebase SDK to your project, or see the Android SDK Setup guide for detailed integration steps.


Step 3: Generate Service Account Key

The Service Account Key allows Ocamba to send push notifications through Firebase on your behalf.

3.1 Access Service Accounts

  1. In your Firebase project, click the gear icon (⚙️) next to “Project Overview”
  2. Select Project settings

Firebase Project Gear

  1. Go to the Service accounts tab

Firebase Generate Private Key

3.2 Generate Private Key

  1. Click Generate new private key
  2. Confirm by clicking Generate key
  3. A JSON file will be downloaded automatically

Firebase Confirm Generate Key

Warning
Store this file securely. The private key grants access to your Firebase project. If compromised, revoke it immediately and generate a new one.

Step 4: Enable FCM API

Ensure the Firebase Cloud Messaging API is enabled for your project.

4.1 Enable in Firebase Console

  1. In your Firebase project, go to Project settings > Cloud Messaging
  2. Ensure Cloud Messaging API is enabled

Firebase Enable Cloud Messaging

4.2 Enable in Google Cloud Console

  1. Go to the Google Cloud Console - FCM API
  2. Select your Firebase project from the dropdown
  3. Click Enable (if not already enabled)

Enable FCM API

Note
If you see “API Enabled”, you’re all set. No action needed.

Step 5: Upload Credentials to Ocamba

5.1 Access Configuration Settings

  1. Log into your Ocamba Portal
  2. Navigate to Hood > Configurations
  3. Select your configuration (or create a new one)
  4. Go to Configuration tab

5.2 Upload Service Account Key

  1. Click Upload or drag and drop your Service Account JSON file
  2. Click Save

You’ve successfully configured Firebase credentials for Android push notifications in Ocamba!


Troubleshooting

“Invalid Service Account Key” Error

Cause: The uploaded JSON file is not a valid Firebase Service Account key.

Fix:

  • Ensure you downloaded the key from Project settings > Service accounts (not from Google Cloud Console IAM)
  • Verify the JSON file contains "type": "service_account"
  • Try generating a new key

Push Notifications Not Arriving

Cause: FCM API may not be enabled or credentials are incorrect.

Fix:

  • Verify FCM API is enabled in Google Cloud Console
  • Check that the Service Account key matches your Firebase project
  • Ensure google-services.json is in the correct location in your Android project
  • Verify your app’s package name matches the one registered in Firebase

“google-services.json Not Found” Build Error

Cause: The configuration file is missing or in the wrong location.

Fix:

  • Place google-services.json in the app/ directory (not the project root)
  • Sync your project with Gradle files
  • Verify the file name is exactly google-services.json

SHA-1 Certificate Issues

Cause: Some Firebase features require SHA-1 fingerprint verification.

Fix:

  • Run ./gradlew signingReport in your project directory to get your SHA-1
  • Add it to your Firebase app settings under Project settings > Your apps > SHA certificate fingerprints

FAQ

Do I Need a Paid Firebase Plan?

No. The Firebase Spark (free) plan includes Firebase Cloud Messaging with no message limits. FCM is free for all users.

Can I Use the Same Firebase Project for Multiple Apps?

Yes. You can add multiple Android apps (and iOS apps) to a single Firebase project. Each app will have its own google-services.json file.

What Permissions Does the Service Account Have?

The Service Account key generated from Firebase Console has the Firebase Cloud Messaging API Admin role, which allows sending push notifications. It does not have access to other Firebase services unless explicitly granted.

How Do I Rotate/Replace My Service Account Key?

  1. Generate a new key in Firebase Console (Project settings > Service accounts)
  2. Upload the new key to Ocamba
  3. Delete the old key from Firebase Console
  4. The old key will be immediately invalidated

Next Steps

After configuring your Firebase credentials, continue with the Android SDK Setup to integrate the Hood SDK into your app.