For Android Apps only, 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 Service Account is a special type of account from Google that applications use to make authorized calls to a variety of APIs, including Firebase Cloud Messaging APIs. For more details, see Google's own documentation on Service Accounts. In order to send push notifications to Android devices, you will need a Service Account to generate a private key for OneSignal to utilize.
Push Notifications require a Firebase Project. If you don't have one set up yet, click Add project and follow the directions to set up your project.
If you already have a FCM project, skip to Step 2.
If you've just created a new project, this should already be enabled by default, and you can skip this step. However, if you are using an existing Firebase project, especially an older one, ensure Cloud Messaging API (V1) is enabled.
To check, click the gear icon next to "Project Overview" in the top left of the left-hand menu and select Project settings. Select the "Cloud Messaging" tab.
If Firebase Cloud Messaging API (V1) is disabled, then click the kebab menu icon on the top right corner and open the link.
On the subsequent page, click Enable. You may need to wait a few minutes for the action to propagate to Firebase systems.
In Project settings, go to the Service accounts tab.
Click Generate new private key at the bottom of the page.
You'll then see a warning window. Click Generate key.
Save the JSON file somewhere secure. You will need to access it shortly.
In OneSignal, navigate to Settings > Platforms > Google Android > Activate
Click on Service Account JSON > Choose file and select the JSON file you downloaded from your service account.
What do if migrating from Legacy FCM settings
If migrating from Legacy FCM settings, you will need to select Firebase Cloud Messaging API (V1) from the dropdown menu before uploading the JSON file.
Click Save and Continue.
Select the SDK you are using for your app development and click Save & Continue.
Finally, check that you can copy your App ID and check for subscribed users before clicking Save & Continue to complete your setup.
You now have a key to send push notifications from your app. 🥳
Return to Mobile Push Quickstart
Updated 2 months ago