Documentation: Push Notifications Onsite Messaging REST API
  1. Documentation
  2. Android App Push Notification
  3. Adding google-services.json File and Google Services Gradle Plugin

Adding Firebase Configuration (google-services.json) File to Your Android App

To send push notifications to your Android App, it is required to add Firebase Configuration (google-services.json) and Google Services Gradle Plugin to your App.

Step 1: Create a Firebase Project

If you already have a Firebase Project, jump to Step 2. Otherwise follow the steps at Creating a Firebase Project.

Step 2: Register your app with Firebase

  • Go to the Firebase console of the project.
  • In the center of the project overview page, click the Android icon.
    Firebase - Add Android App
  • Enter your app's package name in the Android package name field.
    (Optional) Enter other app information: App nickname and Debug signing certificate SHA-1.
    Firebase - Setting Up Android App
  • Click Register App.

Step 3: Add a Firebase configuration file

  • Add the Firebase Android configuration file (google-services.json) to your app:
    Download google-services.json
    1. Click Download google-services.json to obtain your Firebase Android config file.
    2. Move the downloaded config file into the module (app-level) root directory of your app (usually <project>/app).
  • To make the values in your google-services.json config file accessible, you need the Google services Gradle plugin (google-services).
    1. In your root-level (project-level) Gradle file (<project>/build.gradle), add the Google services plugin as a buildscript dependency:
      buildscript {
      
          repositories {
              // Make sure that you have the following two repositories
              google()  // Google's Maven repository
              mavenCentral()  // Maven Central repository
          }
          
          dependencies {
              ...
              // Add the dependency for the Google services Gradle plugin
              classpath 'com.google.gms:google-services:4.3.14'
          }
      }
      Copy
    2. In your module (app-level) Gradle file (usually <project>/app/build.gradle), add the Google services plugin:
      plugins {
          id 'com.android.application'
          
          // Add the Google services Gradle plugin
          id 'com.google.gms.google-services' apply true
          ...
      }
      Copy
    3. Click Sync Now
    4. .