Push Notifications Setup (FCM)

A complete visual guide to configure Firebase Cloud Messaging for your Android app. Covers signing configuration, SHA-1 fingerprint, Firebase project linking, and uploading the service account key to your hosting.

1

Open Project Structure in Android Studio

First, open your Android project in Android Studio. To configure the signing keys, you need to access the Project Structure dialog.

  1. Click on the Settings gear icon in the top-right toolbar of Android Studio.
  2. From the dropdown menu, select Project Structure... (shortcut: Ctrl+Alt+Shift+S).
Open Project Structure from Settings menu
2

Configure Signing Keys

In the Project Structure dialog, you will configure the Signing Configs needed to generate your app's SHA-1 fingerprint for Firebase.

  1. In the left panel, click on Modules, then select your app module.
  2. Switch to the Signing Configs tab at the top.
  3. Select the release configuration, then fill in the following fields as annotated in the image:

Once everything is filled in, click OK 6 to save.

Signing Configs in Project Structure
3

Run the Signing Report to Get SHA-1

Now you need to extract the SHA-1 fingerprint from your release signing key. Firebase requires this to link your Android app securely.

  1. 1 Open the Gradle panel on the right side of Android Studio (click the elephant icon if it's collapsed).
  2. 2 Expand your project name → app.
  3. 3 Expand Tasksandroid.
  4. 4 Double-click on signingReport to execute it.
Gradle signingReport task location
4

Copy the SHA-1 Fingerprint

After the signingReport task completes, the output will appear in the Run panel at the bottom of Android Studio.

  1. Scroll through the output and locate the section for Variant: release (highlighted with a red arrow).
  2. Find the line that starts with SHA1: — this is your release SHA-1 fingerprint (highlighted in yellow with a red arrow).
  3. Select and copy the entire SHA-1 value (e.g., 3F:BF:F4:20:05:1F:...).
SHA-1 fingerprint in signingReport output
Important: Make sure you copy the SHA-1 from the release variant, not the debug variant. The release SHA-1 is the one Firebase needs for production builds.
5

Add SHA-1 to Firebase & Download google-services.json

Now head to the Firebase Console, open your project, and go to Project Settings (gear icon) → scroll down to Your apps section.

  1. 1 Select your Android app from the list. You will see your app's Package name displayed there.
  2. 2 Scroll down to the SHA certificate fingerprints section. Click Add fingerprint and paste the SHA-1 value you copied from Android Studio in the previous step.
  3. 3 After adding the fingerprint, click the google-services.json button to download the updated configuration file. You will need to place this file in your Android project's app/ directory.
Firebase Project Settings - Android app SHA and google-services.json
Tip: After downloading the new google-services.json, replace the existing one in your Android Studio project under the app/ folder, then re-sync Gradle.
6

Generate the Firebase Private Key

Still in Firebase Console → Project Settings, switch to the Service accounts tab at the top.

  1. 1 Click on the Service accounts tab.
  2. You will see the Firebase Admin SDK section with your service account email.
  3. 2 Click the Generate new private key button at the bottom.
  4. A confirmation dialog will appear — click Generate key. A JSON file will be downloaded to your computer automatically.
Firebase Service Accounts - Generate Private Key
Keep this file safe! This JSON file contains sensitive credentials. Never share it publicly or commit it to a public repository.
7

Navigate to the Public Folder on Your Hosting

Now you need to upload the downloaded private key file to your website's hosting server. Log into your cPanel and open the File Manager.

  1. Navigate to your website's root directory (your domain folder).
  2. You will see the standard Laravel folder structure (app, bootstrap, config, database, public, resources, routes, storage, vendor, etc.).
  3. 1 Open the public folder — this is where your publicly accessible files live.
cPanel File Manager - Laravel root directory
8

Locate the Firebase Folder

Inside the public directory, you will find several folders and files.

  1. 1 Look for the folder named firebase and open it. This is the dedicated directory where the Firebase service account key must be placed.
cPanel - public folder contents with firebase folder
9

Upload the Private Key File

Inside the public/firebase folder, you need to upload the JSON file you downloaded from Firebase in Step 6.

  1. Click Upload in the cPanel toolbar and upload the downloaded JSON file.
  2. After uploading, rename the file to exactly: private_key.json

Once uploaded, you should see the file private_key.json inside the firebase folder as shown below:

private_key.json uploaded in public/firebase folder
10

Verify the Private Key File Contents

As a final verification step, you can open the private_key.json file using the cPanel code editor to confirm its contents are correct.

  1. Right-click on private_key.json and select Edit (or View).
  2. Verify that the JSON structure contains all the required fields: type, project_id, private_key_id, private_key, client_email, client_id, auth_uri, token_uri, etc.
  3. Make sure the file is not corrupted or truncated. The JSON should start with { and end with }.
Viewing private_key.json contents in cPanel editor
🎉 All Done! Your Firebase Cloud Messaging setup is now complete. Push notifications from your admin dashboard will be delivered to all users who have your Android app installed.
×