FCM Fallback Delivery


To burst through Android power saving mode, we can deliver your notifications through Pushy's MQTT channel and Firebase Cloud Messaging simultaneously, for improved reliability.

The Pushy Android SDK will automatically check whether the notification was already received, to ensure your app will receive each notification only once even though it is sent through both gateways.

Add Firebase to Your Project

Follow these instructions (Option 1) to log into the Firebase Console with a Google account, create a Firebase Project, and register your Android app with Firebase.

Please follow all instructions on this page under Option 1. Note that you do not have to set up Google Analytics for your project.

  • Click Add project and fill out the form
  • Click the Android icon and register your app (enter your package name)
  • Download google-services.json and place it in your app/ folder
  • Include the Firebase SDK by modifying your build.gradle files according to the instructions
Add FCM Dependency to Your Project

Add the following dependency to the build.gradle in your app/ folder:

implementation 'com.google.firebase:firebase-messaging:20.0.1'

Note: Please check the official documentation for the latest version of this package.

Update Pushy SDK

Please make sure your app is using the latest version of the Pushy Android SDK.

Return to this page when you're done.

Modify AndroidManifest

Add the following <service> declaration to your app/src/main/AndroidManifest.xml, inside the <application> tag:

<!-- Pushy Firebase Service -->
<service
    android:name="me.pushy.sdk.services.PushyFirebaseService"
    android:exported="false"
    android:stopWithTask="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Note: You may skip this step if you're using a Cordova-based development environment.

Enable FCM Fallback Delivery

Invoke Pushy.toggleFCM(true) before Pushy.register():

// Enable FCM fallback delivery
Pushy.toggleFCM(true, getApplicationContext());

Note: Please omit the second argument if you are using a hybrid development environment such as React Native or Cordova.

Build and Test

Run your app and observe the logcat to see whether integration is working as expected:

D/Pushy: FCM device token updated successfully
Create a Firebase Service Account

For Pushy to be able to send notifications through Firebase, we need to be able to authenticate on behalf of your Firebase account. Please create a Firebase Service Account, generate a private key, and upload it to the dashboard:

  • In the Firebase console, open Settings > Service Accounts
  • Click the relevant Firebase project
  • Scroll down and click Generate New Private Key, then confirm by clicking Generate Key
Upload Firebase Account Key

Visit the Pushy Dashboard -> Click your app -> App Settings -> Configure FCM Fallback Delivery.


Drag and drop the .json Firebase Service Account Private Key you downloaded in the previous step, and click Upload to finish setting up FCM fallback delivery for your app.

Note: Avoid revoking your Firebase Service Account while it is being used by Pushy for fallback delivery.

Send Test Notification

Try sending yourself a notification and check whether it is being delivered by FCM and Pushy simultaneously, by observing the logcat for the following:

D/Pushy: Received push via FCM for package {...}

Input a device token and select your app to send a test push notification:

Note: You can specify a topic instead of a device token (i.e. /topics/news). Also, if your app is not automatically detected, please manually copy the Secret API Key from the Dashboard and paste it into the form.

Did you receive the notification? If not, reach out, we'll be glad to help.

Integration Complete


Congratulations on integrating FCM fallback delivery in your app!

From now on, every notification you send through Pushy will simultaneously be sent through Firebase Cloud Messaging with priority = high and ttl = 0 to burst through Doze mode and other power saving modes such as App Standby.