Introduction
This article covers how to set up a Firebase project for your branded mobile app. You will need to do this if you want any of the following functionality on your branded app:
- Push notifications
- Google analytics
- Google sign-in
Additional information about each of the Events received in Firebase Analytics.
Prerequisites: App ID and Store links
Before you do the Firebase configurations described here you should have completed the following steps:
- Select an ID for your branded mobile app. It is recommended to use reverse domain notation (eg com.docebo.mobile). This will correspond to the packageId for Android, and to the bundleID for iOS. Your ID must be unique and not already present in those stores. Preferably, it should be the same for both stores (though this is not required)
- For each store, in Google Play Console / App Store Connect go through the procedure to create the app (you do not need to upload a build yet). During this process you will be asked to provide your chosen ID, and the app creation will generate a Store Link such as the following:
https://play.google.com/store/apps/details?id=com.yourcompany.mobile
https://apps.apple.com/us/app/go-learn/id3141592653
By creating the apps first in this way you can be sure that the chosen app ID is unique.
→ make a note of your app ID and the Store links, you will need to insert these in subsequent configurations.
Create a Firebase project
If you do not already have a Firebase project, create it as follows:
- In the Firebase console, click Create a project.
- Enter a name for your project and click Continue.
- In the Google Analytics for your project step, if you want to use the analytics features on your app:
- Select Enable Google analytics for this project Then click Continue.
- In Configure Google Analytics, set the location of your organization and configure whether and how you want to share your analytics data with Google.
(if you do not want to use any analytics features you can leave the toggle deselected)
- Click Create project.
Get Firebase Project ID and Services Account Configuration file
In your Firebase project page, in the sidebar next to Project Overview click the gear icon, then select project settings.
→ Make a note of the Firebase Project ID, you will need to insert this when you configure the branded app on the platform.
Now select the Service accounts tab, and at the bottom of the screen click Generate a new private key. In the dialog box, click Generate key to confirm.
→ Store the downloaded .json file (example name, acnard-test-firebase-adminsdk-33ipy-4cf9aa3e78.json) to a location where you can access it when configuring the branded app on the platform.
Connect your Android app to Firebase
In your Firebase project, select gear icon > project settings and in the General tab, under Your apps, click Add app and click the Android icon.
In step 1 - Register app: In Android package name enter the packageID of your branded app (eg com.yourcompany.mobile).
(You can find this value on Google Play Console. See also the prerequisites chapter of this article.)
Then click Register app.
In step 2 - Download and add config file: click Download google-services.json
→ store this file where you can access it for later configurations.
Then click Next.
In step3 click Next, and in step 4 click Continue to console.
→ You will see the newly added Android app under the Your apps section of the Firebase console.
Connect your iOS app to Firebase
In your Firebase project, select gear icon > project settings and in the general tab, under Your apps, click Add app and click the iOS icon.
In step 1 - Register app:
- In App bundle ID enter your branded app’s bundleID (eg com.yourcompany.mobile).
- In the App Store ID field enter the numeric code at the end of your app Store link.
(You can find both these values on App Store Connect. See also the prerequisites chapter of this article.)
Then click Register app.
In step 2 - Download config file: click Download GoogleService-Info.plist.
→ store this file where you can access it for later configurations.
Then click Next.
In steps 3 and 4 click Next, then in step 5 click Continue to console.
→ You will see the newly added iOS app under the Your apps section of the Firebase console.
Enable Google sign-in
Perform these steps only if you want to enable Google Sign-In (using Gmail or Google Apps) on your branded mobile app. Otherwise you can skip this chapter.
The steps to complete for Google Sign-in are: Web client ID, iOS Client ID (only for iOS app), SHA certificate fingerprints(only for Android app), and Download latest configuration files.
Web client ID
This step is required to enable Google sign-in on both iOS and Android mobile apps.
In your Firebase project:
- From the sidebar click Authentication, select the Sign-in method tab, and click the Google icon.
- Set the toggle to Enable, and enter a value in Support email for project.
- Then click Save.
- You can close the Download the latest configuration file dialog box because you will download those files later, as the final step in this chapter.
- You will now see Google listed as an enabled provider. Click the pencil icon to edit and then expand the Web SDK configuration section.
→ copy and save the value in the Web client ID field, you will need to insert this when you configure the branded app on the platform
iOS Client ID
Now to enable Google sign-in for the iOS app, perform the following additional steps:
- Click the link you see in the hint balloon next to Web SDK configuration to open the Credentials section of the Google API console.
- In the Google API console for your project, under OAuth 2.0 Client IDs:
→ copy and save the value of the the Client ID for the iOS app, you will need to insert it when you configure the branded app on the platform
(Note: The Web client ID is the same as that copied previously).
SHA certificate fingerprints
For Google sign-in to work on the Android app, you also need to provide the SHA-1 fingerprint of your signing certificate and paste it into the Firebase console. Refer also to the instructions in the Google developer guide on Authenticating your client (opens in a new tab).
Method 1: Obtain SHA-1 fingerprint from Google Play Console
If you've published your app using Play App Signing–which is the recommended method, and a requirement when using Android App Bundle–you can get your SHA-1 from the Google Play Console as follows.
Open the Google Play Console then select the app you want and then you can find the Play App Signing page under Release > Setup > App Integrity. Copy the SHA-1 certificate fingerprint from here.
Method 2: Obtain SHA-1 fingerprint with keytool
To obtain the SHA-1 fingerprint of the certificate, open a terminal and run the keytool utility provided with Java.
keytool -list -v -keystore ./yourcompany.keystore
The keytool utility prompts you to enter the password for your keystore. This is the password that was set when the keystore was created. The keytool then prints the fingerprint to the terminal.
- Copy the fingerprint obtained from the keytool.
- In the Google Play Console:
- Select Setup > App Integrity and then select the App signing tab.
- Under App signing key certificate paste the fingerprint previously copied in step 1 into the SHA-1 certificate fingerprint field.
Paste SHA-1 fingerprint into Firebase console:
Once you have obtained the SHA-1 fingerprint by one of the two methods described previously, the final step is to paste it into the Firebase console.
In the Firebase Console:
- Select gear icon > project settings > general tab. Then scroll down to Your apps and select the Android app.
- Click Add fingerprint and paste in the previously copied SHA-1 fingerprint.
Note: If you have previously released a version of your branded app, the fingerprint will already be present in the SHA-1 certificate fingerprint field. In any case, make sure the field is populated with the correct SHA-1 certificate fingerprint, which you copied in the preceding steps.
Download latest configuration files
This is the final step for Google sign-in.
In your Firebase project, download the latest configuration files. These will replace the ones you downloaded when adding the apps to firebase:
- Select gear icon > project settings > general tab.
- Scroll down to Your apps.
- Select the Android app and download the latest version of google-services.json.
- Select the iOS app and download the latest version of GoogleService-Info.plist.
Set up iOS Apple Push Notification service (APNs) key
Perform these steps if you are configuring push notifications and you have an iOS branded app. Otherwise you can skip this chapter.
To be able to send push notifications to iOS devices, you need to create an APNs (Apple Push Notifications service) Authentication Key in the Apple Developer Console, associate it with your iOS app and then upload the private key in the Firebase Project settings. Please note that the same private key is used for all of your apps.
Obtain your Team ID:
- Log into the Apple Developer Console.
- Navigate to the Membership section from the left menu
- Copy the Team ID value from the Membership details.
→ You will later need to enter this into Firebase
Create the APNs key:
- In the Apple Developer Console click Certificates, Identifiers & Profiles.
- Click Keys then the + icon button in the top right corner to create a new key.
- Enter a name for your APNS Auth Key, then select the Apple Push Notification Service (APNs) option.
- Click Continue, verify the information and click Confirm.
- Click Download to download your auth key file. Copy and save the Key ID which you'll need later.
Please note that you can only download the file once. Make sure you save this file properly and create a backup for later. Do not rename the file.
Enable push notifications capability for your iOS App ID:
- In Certificates, Identifiers & Profiles, click Identifiers in the sidebar.
- View your app’s details by clicking its App ID.
- In the Capabilities tab, scroll down and check the Push Notifications capability.
- Save your changes.
Regenerate the provisioning profile:
- In Certificates, Identifiers & Profiles, click Profiles in the sidebar.
- Under Provisioning Profiles, select the invalid or expired provisioning profile, then click Edit.
- Click Generate.
Upload the APNs key to Firebase:
Now log into the Firebase Console:
- Click gear icon> Project Settings and select the Cloud Messaging tab
- Scroll down to the Apple app configuration section.
- Under APNs Authentication Key, click Upload and upload the key you previously downloaded from the Apple Developer Console, and fill in the Key ID and the Team ID fields.
- When ready, click Upload. You’ve now linked your Firebase project to the app in the Apple Developer Console.
Summary of branded mobile app publisher settings
This chapter summarizes how the Firebase configurations covered in this chapter are entered into the branded mobile app publisher on the platform.
Parameter | Where set in branded mobile app publisher | When used |
App ID | Android tab | |
Store Link |
Android tab iOS tab |
|
Firebase project ID Firebase services account configuration file |
In Properties tab |
Only if you select Enable push notifications *you must select this if you want push notifications, but also if you want Google analytics. |
google-services.json configuration file | Android tab | If you are using any of the Firebase services (push notifications, Google analytics, or Google sign-in) |
GoogleService-Info.plist configuration file | iOS tab | |
Web client ID |
Android tab iOS tab |
Only if you configured Google sign-in. Otherwise enter the string “PUSH-ONLY” in these fields |
iOS client ID | iOS tab |
Next steps
Once you have configured all the Firebase services required for your branded mobile app, you can proceed (or go back to) setting up your app in the branded mobile app publisher.
See → Branded mobile app publisher