Setting Up Firebase Messaging (Android Push Notifications)
To enable Push Notifications in your Android App, you must first create the necessary 'Sever Key' and 'google-services.json' file in Google Firebase.
This tutorial explains how to generate these files from start to finish and how to incorporate them into your Android App as part the build request process in App Wizard.
1. Required Firebase Files
In order to enable Push Notifications in any Android App, you need to create two particular files:
a. the legacy server key; and
b. the google-services.json file.
Both these file can be created in the Google Firebase Console. If you don't have a Google Developer Account, you'll need to create one first before going to the Firebase Console.
This screenshot below shows the Push Notifications section for an example Android App (accessed from the App's Dashboard). Once the files are created, they are added at the bottom of the page (as highlighted).
2. How to get the Server Key and JSON File
First of all you will have to create a new project in the Firebase Console.
Open the Firebase Console and select 'Add Project' (as shown above).
3. Name Your Project
In the 'Project Name' field, enter your project name and select continue. We recommend you use the same name as the Android App which you intend to enable Push Notifications in.
4. Enable Google Analytics
Toggle the 'Enable Google Analytics for this project' switch on, and then click 'Continue'.
5. Configure Google Analytics
Select your Google Analytics account (or create a new account) and click the 'Create Project' button.
Note: If you don't want to link your project to a Google Analytics account, toggle the 'Enable Google Analytics for this project' switch off in Step 4 above.
Please wait while your project configures, then select 'Continue'.
6. Select Platform
Select the Android icon as shown above.
7. Add Your Android Package Name / Register your App
It is important to get the 'Android Package Name' correct. Please read the instructions below.
Enter the correct package name in the 'Android package name' field. The package name is found by clicking the three vertical dots on the App's Dashboard (as shown in the screenshot below).
For a new unpublished App, the package name is comprised of the 'AppID' with com. added in front. For example, the package name for the 'Franchise' App (as shown in a. below) would be 'com.icaddyapps.Franchise'.
If the application has been previosuly submitted to Google Play, then the Android Package Name is the same as the 'Unique AppID' (as shown next to b. in the image below).
Note: The Package name is also set in App Wizard during the submission process for your application. It is important to ensure you use the same package name each time for the same App. This is described in more detail in Step 12 below.
8. Complete the Registration Process
After entering the Package Name, you can enter an App 'nickname' if preferred (this is optional).
Ordinarily, you can disregard the 'Debug signing certificate SHA-1' field - this is only required if you are enabling dynamic links etc.
Click 'Register App' to complete the App Registration process (as shown below).
9. Download the 'google-services.json' file
Click the 'Download google-services.json' button (as shown below). Disregard all the text on the screen related to Android studio - this is not relevant to Apps built in the App Wizard platform.
Note: At this point you have successfully downloaded one of the two required files. Click 'Next' to continue.
After clicking 'Next' in the previous step, a number of code windows and other information will appear below section 3 (Add Firebase SDK). Disregard these fields completely, they are not relevant to Apps developed in App Wizard. Simply click 'Next' at the bottom of the screen.
Click 'Continue to console' to return to the Firebase Console.
10. Locate and Copy the 'Legacy Server Key'
From the Firebase Console, click the cog icon on the right hand side of 'Project Overview', then select 'Project Settings' from the drop down menu (as shown below).
In 'Project Settings' select the 'Cloud Messaging' tab then copy the 'Server Key' (as per steps (a) and (b) respectively in the screenshot below).
Note: You now have all you need to complete the set-up in your App Wizard account.
11. Add the Legacy Sever Key and .json File to Your App
Log in to your App Wizard account and navigate to the App's Dashboard. Select 'Push Notifications' from the list of options available (as shown below).
These are the last steps:
a. Paste the Legacy Server Key copied from Firebase.
b. Upload the google-services.json file downloaded from Firebase.
c. Select Save.
You have now successfully setup Firebase Push Notifications in your App!