Create Firebase project
For Android, we use Firebase Cloud Messaging (FCM) to send push notifications. To be able to use this, you need to create a Firebase project for your application:
1. Create a new Firebase project
You need to create a Firebase project so that you can download the push configuration file for the Android platform. To do this:
- Log in to the Firebase Console with your Google account. If you do not have have one, then you can create a Google account for free.
- On the Firebase Console home page, click the Add project button.
- Enter a project name. This name should be relevant to your name or business.
- Optional: Choose whether to enable Google Analytics for your project. This is not a requirement, but can be enabled at this point if you want analytics tracking.
- Click the Create project button, then click Continue.
2. Download the push configuration file
You must generate the platform-specific configuration file that links your app to Firebase services. This configuration file is necessary to enable push notifications. To do this:
- In the left-side menu of your Firebase project dashboard, click the Settings gear icon, then select Project Settings.
- Select the General tab, then scroll down to the Your Apps section.
- Click the Add app button, then select the Android platform.
- Enter your Android app's package name.
Tip
You can also add a nickname for the app and specify the SHA-1 if required. The SHA-1 is optional for push notifications, but may be required for other Firebase services.
- Click the Register app button.
- Download the
google-services.jsonconfiguration file and store it in a secure place. - Skip the next steps, then click the Continue to console button.
3. Create the service account key
- In the left-side menu of your Firebase project dashboard, click the Settings gear icon, then select Project Settings.
- Select the Service accounts tab and click the Google Cloud link for All service accounts. This will open the Google Cloud Project associated with your Firebase project.
- In the left-side menu click on Service Accounts
- With Firebase Admin SDK selected, press Generate new private key.
- When the new
.jsonkey file is downloaded, ensure that you store it in a secure place.