Push Notifications for Android

There are 2 stages to complete in order to setup Push Notifications with Sailthru Mobile:

  1. Generate your private key file
  2. Upload your private key file to Sailthru

Generate your private key file

  1. Login to your Firebase account
  2. Select your project
  3. Select the cog icon next to ‘Project Overview’ then select ‘Project settings’

  4. Ensure ‘Firebase Cloud Messaging API” is enabled
    1. Go to the ‘Cloud Messaging’ tab
    2. If ‘Firebase Cloud Messaging API (V1)’ does not display “Enabled” next to it, you will need to enable it
      1. Select the three dots icon on the right hand side

      2. Select ‘Manage API in Google Cloud Console’ (it will open in another tab)
      3. Click the ‘Enable’ button
  5. Go to the Service Accounts tab
  6. Click Generate New Private Key (.json file), then confirm by clicking Generate Key
  7. Securely store the JSON file containing the key

Upload your private key file to Sailthru

  1. Login to your Sailthru account
  2. Go to Settings > Developer > Google Android
  3. Upload the .json file to the Service Account (.json) upload field
  4. If this was done successfully you will see
    1. “This certificate is valid”, and
    2. “Service Account: Uploaded and saved successfully” (top right corner of screen)
  5. If this was not done successfully you will see
    1. This upload field remains blank, and
    2. Related error messages (top right corner of screen)

Having trouble uploading your Service Account (.json) file?

If you are unable to upload your private key file to Sailthru, check your permissions

  1. Click Manage service account permissions
  2. Click View Access
  3. Click Analyze > Run query
  4. See which role(s) your app is assigned:

    To be able to send messages, the role must have these specific permissions:
    • cloudmessaging.messages.create
    • firebasenotifications.messages.create
    • firebasenotifications.messages.delete
    • firebasenotifications.messages.get
    • firebasenotifications.messages.list
    • Firebasenotifications.messages.update

If you are using Firebase’s default roles, these roles contain the correct permissions:

    • Firebase Admin
    • Firebase Grow Admin
    • Firebase Admin SDK Administrator Service Agent

Otherwise, you will need to create a new role or update an existing one, and grant it to a service account.

To create a new custom role:

  1. Go to the Google Cloud Console
  2. IAM & Admin > Roles
  3. “+ Create Role”
  4. Fill in the fields
  5. Add the above permissions
    1. Note, there are two filters.
    2. Filter by property name or value and search for the above permissions
  6. Create

To create a new service account and a new private key:

  1. Go to Service Accounts from the left side nav
  2. “+ Create Service Account”
  3. Fill in the fields
  4. “Create and continue” to Step 2
  5. Select a role > Custom > The role you just created
  6. Done
  7. Select the new service account you just created
  8. “Keys”
  9. “Add key” > “Create new key”
  10. You should now have your new service_account.json key

Contact us