Skip to main content
The Notifly Android SDK connects your Android app to Notifly.
The SDK supports the following features:
  • Register devices with Notifly to receive push notifications and display in-app popups. (In-app popups appear only while the app is in the foreground.)
  • Send event and user data to Notifly for campaign targeting and analysis.
  • Log user behavior as events and measure campaign performance.

Prerequisites

  1. Connect your Firebase project.
    The Notifly Android SDK uses Firebase Cloud Messaging to send push notifications.
Connect Firebase
  1. Android 11 (API level 30) or later for in-app popups.
    In-app popup campaigns are supported only on Android 11 or later.

1. Install the SDK

The Notifly Android SDK is distributed through JitPack.

Configure Gradle

settings.gradle

Add the SDK dependency

build.gradle (Module: app)
The SDK receives frequent feature and security updates. Use the latest version on JitPack.

Initialize the SDK

Initialize the SDK in your Application class. If you initialize it in a specific Activity, initialization may not apply to other Activities.
If your app does not have an Application class,
create one and register it with the android:name attribute in AndroidManifest.xml.
AndroidManifest.xml
Add the following code to onCreate in your app’s Application class.
MainApplication.kt
Find NOTIFLY_PROJECT_ID and USERNAME on the settings page. PASSWORD is a placeholder for backward compatibility. Pass the same nonempty value as USERNAME. Do not pass a real password or API Secret Key.

2. Register user information

Notifly uses user identifiers (userId) and user properties (params) to personalize marketing campaigns.
Registered user information supports segmentation and targeting for channels such as push notifications, email, and Kakao AlimTalk.
Complete SDK initialization with Notifly.initialize() before calling the user methods.

Set the user ID (Notifly.setUserId())

Map userId to the identifier of the signed-in user in your app.
Notifly uses this value to track user events and personalize campaigns.
Context
required
Android context object.
String
required
The signed-in user’s ID. Pass null on sign-out to clear the association.

Clear the user ID

On sign-out, call setUserId(null) to clear the association between the current device and the user. To retain the same user data, manage it separately on your server or in your app.
setUserId

Set user properties (Notifly.setUserProperties())

setUserProperties registers properties for the user.
These properties support segment targeting, message personalization, and delivery channel selection.
Before you send sensitive user propertiesBefore you send a custom user property that needs protection, such as a name or address, register it with the exact key you plan to send and enable encryption under User Management > User List > Property management in the console.See Manage user properties for setup instructions and limitations.
Context
required
Android context object.
Map<String, Any?>
required
Key-value pairs of user properties. Supports predefined keys such as $email, $phone_number, and $line_user_id.
  • $email: Email address for email campaigns.
  • $phone_number: Phone number for SMS and Kakao campaigns.
  • $line_user_id: LINE user ID for LINE message campaigns.
  • Custom fields: Define your own fields, such as "plan", "tier", and "country".
setUserProperties

3. Log events (Notifly.trackEvent())

Record user behavior to use in campaign triggers, segment conditions, and performance analysis.
For example, collect button clicks, page visits, and completed purchases as events.
Context
required
Android context object.
String
required
Event name, such as "click_button" or "purchase_completed".
Map<String, Any?>
Additional event parameters, such as "plan": "premium" or "duration": 120.
List<String>
List of event parameter keys to use for segmentation. Supports at most one key.
segmentationEventParamKeys currently supports at most one key.
  • For example, listOf("plan") makes the "plan" event parameter available for segmentation.
Notifly.trackEvent

4. Get the internal user ID

getNotiflyUserId() returns the unique user ID that Notifly manages internally.
This ID is separate from the user ID set with setUserId(). Most integrations do not need it.
Use it when an external CRM or third-party integration requires Notifly’s internal user ID.

5. Test the integration

After you install the SDK, follow Test your integration to verify event collection and push notification delivery.

6. Advanced integration

Push notification icons

Request push notification permission

Push notification click events

Push notification interceptor

In-app popup event listener

WebView


FAQ

The Notifly Android SDK can work alongside Firebase Cloud Messaging that your app already uses.