Android: Firebase Credentials
Directions on how to generate a Firebase Server API key for sending Android App Notifications
For Android Apps, not websites
This guide is for developers implementing OneSignal in an Android application for distribution on the Google Play App Store. This guide should not be used for Web Push.
A Google Firebase Server Key is required for all Android mobile apps and Chrome app extensions. It is optional for Amazon apps.
What is a Firebase Server Key?
A Firebase Server Key and Firebase Sender ID are required in order to send push notifications to Android mobile app devices.
The goal of this section is to provision your Firebase Server Key and Firebase Sender ID for use in OneSignal.
Requirements
- An Android mobile app, Chrome app or extension, or an Amazon app.
- A Firebase account
- A OneSignal Account, if you do not already have one.
Step 1. Create A Firebase Project
Push Notifications require a Firebase Project. If you don't have one setup yet, click Add project and follow the directions to setup your project.
If you already have an FCM project, skip to Step 2.
Step 2. Getting Your Firebase Cloud Messaging Token And Sender ID
Click the gear icon in the top left and select Project settings.
Select the Cloud Messaging tab.
Under "Cloud Messaging API (Legacy)" click on the options (three dots on the right) and click "Manage API in Google Cloud Console". OneSignal will soon add support for the latest Firebase Cloud Messaging API (V1), but for now, the Cloud Messaging API works perfectly.
This will open a new page, under Cloud Messaging press "Enable".
Refresh the page on your Firebase Console and copy your Server key and Sender ID.
Step 3. Configure Your OneSignal App's Android Platform Settings
In the OneSignal dashboard, select your app, then go to:
Settings > Platforms > Google Android
Paste your Firebase Server Key and Firebase Sender ID into the fields and click Next all the way to Save.
Done!
You now have a key to send push notifications from your app. 🥳
Return to Mobile Push Quickstart
FAQ
Can I use the same Firebase Keys for multiple apps?
Yes, you can use the same Sender ID and Firebase Server API key for multiple apps created in OneSignal. If you plan to export this data or sell the app or use Google Analytics for Firebase you should create unique Firebase Projects in these cases.
How can I change my Firebase Keys if I have over 100 users?
If possible, never change these keys. If you did change or accidentally deleted your Firebase project, you must contact [email protected] with the OneSignal App ID, new FCM Sender ID, and new FCM Server API key for us to update it.
Updated over 1 year ago