App Messages

A quick start guide to adding App Message support to your Android application with the Pushly PushSDK

App Messages, unlike Push Notifications and Live Activities, allow you to interact with and engage your user base without the need for a subscription token. App Message can be configured to automatically display based on a number of criteria including custom conditions that can be provided programmatically.

For App Messages with custom conditions the PushSDK provides convenience methods for you to signal when these conditions have been met as well as the ability to listen to certain lifecycle events.

Prerequisites

Before you can integrate App Messages with the SDK the following requirements must be met:

  • An app that uses Jetpack (AndroidX)

  • Android device or emulator running API 19+ (Android 4.4) with Google Play Store Services installed.

  • PushSDK release supporting App Messages (See version support chart below)

Step 1: Android SDK Setup

For applications not already using the PushSDK please see our Native App Push setup guide for Android.

For applications already using the PushSDK you might need to upgrade to a later version that includes App Message support. Use the following table to determine if you need to upgrade your installation.

SDK
Earliest Version with App Messages

1.2.0+

1.2.0+

1.2.0+

  • Ensure you are targeting com.pushly.android:pushsdk:[1.2, 1.3[ in your app gradle.

  • Run gradle sync.

dependencies {
    ...
    implementation 'com.pushly.android:pushsdk:[1.2, 1.3['
}

Step 2: Create and Schedule an App Message

Use the Pushly Platform to build and schedule your first App Message.

Step 3: (Optional) Trigger Your App Message's Custom Condition

When using custom conditions the PushSDK is used to provide these conditions programmatically which then triggers an evaluation of which App Messages are currently active and match the provided conditions.

In most cases a single condition is triggered and evaluated at a time. For these situations you would use the trigger(condition: String, value: String) method signature.

PushSDK.AppMessages.trigger(condition = "enabled_subscription", value = "true")

However, there might be situations where it is more convenient to trigger multiple conditions at once for evaluation. In these cases you can pass a HashMap containing any number of conditions to the trigger(conditions: HashMap<String, String>) method signature.

PushSDK.AppMessages.trigger(conditions = hashMapOf(
    "enabled_subscription" to "true",
    "subscriber_tier" to "premium"
))

Step 4: (Optional) Listen to App Message Lifecycle Events

See our SDK Callbacks documentation for information on handling lifecycle events of your App Messages.

Last updated