Skip to main content

Prerequisites

Example can be found in the example/ app.

Step 1: Create a Firebase project in the firebase console

Create a Firebase project (or reuse an existing one) in the Firebase console and register your Android app using its applicationId (the same value as applicationId in android/app/build.gradle).

Step 2: Adding google-services.json to your project

Download the google-services.json file for your registered Android app from the Firebase console and place it in your app module:

Step 3: Adding Firebase dependencies and plugins

Depending on your project, use either the Groovy (*.gradle) or Kotlin DSL (*.gradle.kts) snippets below.
1

Declare the Google Services Gradle plugin

Declare it in settings.gradle (top-level, apply false). Add it to your existing plugins { } block:
2

Apply the plugin in your app module

Add it to the existing plugins { } block:
3

Add the Firebase Messaging dependency in your app module

Step 4: Implementing push

This is the simplest way to implement push and everything is handled by the SuprSend background service, like token generating, attaching it to user, showing notification and tracking analytics. Register the SDK’s messaging service inside the <application> tag of android/app/src/main/AndroidManifest.xml:

Targeting Android 13 (API-33)

1

Add POST_NOTIFICATIONS permission in AndroidManifest.xml if not present already

2

Ask notification permission to show push notifications

The example uses permission_handler: