Android Push Notifications implementation made easy with Bloomreach
Source: Dev.to
Introduction
Push notifications help your app engage users effectively. This guide explains how to implement push notifications on Android using Bloomreach (formerly Exponea) – from a blank project to a working feature.
Prerequisites
- Android app written in Kotlin
- Firebase Cloud Messaging (FCM) configured
- Bloomreach account with push enabled
- Basic understanding of the Android app lifecycle
High‑Level Architecture
- App registers with FCM and obtains a device token.
- Token is sent to the Bloomreach SDK.
- Bloomreach sends push campaigns via FCM.
- FCM delivers the message to the device.
- App displays the notification.
Firebase Setup
- Add Firebase to your project via the Firebase Console.
- Place
google-services.jsonin theapp/folder.
Gradle dependencies
implementation platform('com.google.firebase:firebase-bom:33.0.0')
implementation 'com.google.firebase:firebase-messaging-ktx'
Apply the Google Services plugin
plugins {
id 'com.google.gms.google-services'
}
Integrating the Bloomreach SDK (formerly Exponea)
Step 1 – Add the SDK
implementation("com.exponea.sdk:sdk:4.8.1")
Step 2 – Initialize the SDK
Obtain projectToken, authorization, and baseURL from the Bloomreach Engagement portal (Project Settings → Access Management → API).
Make sure you have user tracking consent before initializing.
val configuration = ExponeaConfiguration().apply {
authorization = "Token YOUR_API_KEY"
projectToken = "YOUR_PROJECT_TOKEN"
baseURL = "https://api.exponea.com"
}
Exponea.init(this, configuration)
Step 3 – Place SDK initialization in your Application subclass
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
val configuration = ExponeaConfiguration().apply {
authorization = "Token YOUR_API_KEY"
projectToken = "YOUR_PROJECT_TOKEN"
baseURL = "https://api.exponea.com"
}
Exponea.init(this, configuration)
}
}
Register the custom application class in AndroidManifest.xml:
<!-- Add your application tag here -->
Push Notifications Setup
Enable Push Notifications in Bloomreach
- Bloomreach Engagement sends notifications via scenarios.
- Notifications can be standard alerts or silent (background) messages.
Implement a Firebase Messaging Service
import android.app.NotificationManager
import android.content.Context
import com.exponea.sdk.Exponea
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
class MyFirebaseMessagingService : FirebaseMessagingService() {
private val notificationManager by lazy {
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
}
override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)
// Let Bloomreach handle the message; return false if it’s from another provider
if (!Exponea.handleRemoteMessage(applicationContext, message.data, notificationManager)) {
// Handle non‑Bloomreach messages here
}
}
override fun onNewToken(token: String) {
super.onNewToken(token)
Exponea.handleNewToken(applicationContext, token)
}
}
Register the service in AndroidManifest.xml:
<!-- Add your service declaration here -->
Configure FCM in Bloomreach
- Create a service account in Google Cloud and generate a private key (JSON).
- In Bloomreach Engagement, add a Firebase Cloud Messaging integration using that JSON key.

Select the integration in Project Settings → Channels → Push Notifications → Firebase Cloud Messaging Integration

After completing the setup, your app will receive push notifications sent through Bloomreach and token tracking will be handled automatically.
End of guide.

