What is Firebase?

Firebase is Android's new push notifications system, replacing Google Cloud Messaging (GCM).

WonderPush lets you use your own Firebase account. This ensures push token portability letting you change provider, should you wish to do so.

📘

Upgrading from a previous version of the Android SDK?

If you application already integrates with Firebase, follow this guide.

Creating your Firebase account

  1. Go to https://console.firebase.google.com/ and sign in with your Google account.
  2. Check with your team if you do not already have a Firebase account and project.
    You may need to be invited to it if it's not listed.
  3. Click Add project and fill the required information.
309
  1. You can stop here if you do not plan on using Firebase within your application, or you can continue and integrate it.
  2. Add an Android app.
    This will generate a google-services.json file and give you instructions for integrating it in your application.

Locating your Sender ID

Use this link to get to the Firebase project Cloud Messaging settings page of your project.
Alternatively, here's how to reach it:

  1. In your Firebase project console, click the gear icon and select Project settings.
529
  1. Go to the Cloud Messaging tab.
  2. Under the Cloud Messaging API (Legacy) section, click the ⋮ menu on the right and select Manage API in Google Cloud Console.
1188
  1. In the new page, click ENABLE to activate the Cloud Messaging API.
914
  1. Go back to the Firebase Console and refresh the page.
  2. Note the Server key, you'll need to give it in the WonderPush dashboard.
    Note the Sender ID, you'll need it if you want a light integration without Firebase.
1049

Filling the Firebase Server Key in the WonderPush dashboard

  1. Go to your WonderPush dashboard, in the Settings / Platforms page, click the Android application section title.
  2. Paste the Server key you got in the Firebase console.
  3. Click Save.
1114

Make your app use your Firebase account

Option 1 - Your app does not use Firebase

If your application does not use Firebase already, don't bother integrating it, you just need to give the Sender ID somewhere in your application.

Configure the WonderPush Android SDK from your app/build.gradle file:

android {
    defaultConfig {
        buildConfigField 'String', 'WONDERPUSH_SENDER_ID', '"YOUR_SENDER_ID"'
    }
}

Replace YOUR_SENDER_ID with your Sender ID.
Just so you know, 1023997258979 is WonderPush default Sender ID.

Option 2 - Your app integrates Firebase

When you integrate Firebase to your application, WonderPush is able to detect the linked Firebase account and use its Sender ID accordingly, so you have nothing to do!

Here is the official guide to integrating Firebase to your Android application.

If you're into details, the google-services.json file that you added to your project contains the Sender ID, and the com.google.gms.google-services plugin that you added to your app/build.gradle creates the corresponding gcm_defaultSenderId string resource to make it available to your app, which WonderPush uses if not already configured otherwise.