Skip to content
Andrew Clunis edited this page Sep 24, 2021 · 4 revisions

Judo-Braze Android

You can use this library to facilitate integrating Judo with Braze, automatically tracking Judo Screen Views into Braze, and making it easy to launch Judo experiences as Braze IAM campaigns.

Installation

Ensure that you have both the Judo and Braze SDKs fully integrated and working before you continue.

To add the dependency to your project's build.gradle. First, add this GitHub repository as a Maven-format repository:

Groovy:

// (Note that this may need to be set in settings.gradle)
repositories {
    // ...
    maven {
        url 'https://judoapp.github.io/judo-braze-android/library/maven'
    }
}

// Add the following in app-level build.gradle:
dependencies {
    implementation 'app.judo:judo-braze:1.0.0'
}

Kotlin KTS:

// (Note that this may need to be set in settings.gradle.kts)
repositories {
    // ...
    maven {
        url = uri("https://judoapp.github.io/judo-braze-android/library/maven")
    }
}

// Add the following in app-level build.gradle.kts:
dependencies {
    implementation("app.judo:judo-braze:1.0.0")
}

Then, in your Application subclass' onCreate method after you initialize both Judo and Braze, call the following:

Judo.integrateWithBraze(this)

Event Tracking

This is automatic; once you call Judo.integrateWithBraze(this), this is configured for you. Look for the event Judo Screen Viewed appearing in Braze.

In-App Messaging Setup

Enabling Judo Experiences as Braze IAM messages takes little bit more setup. You'll need an IInAppMessageManagerListener set up. The integration works by inhibiting Braze's own IAM UI, and instead opening the Judo Experience.

You'll need a little bit of boilerplate to set it up. First, if you don't already have one, create an (anonymous, if you like) object that implements IInAppMessageManagerListener (typically to keep the rest of the default behaviour, you should actually inherit from their default implementation, DefaultInAppMessageManagerListener), and implement the following method on it:

BrazeInAppMessageManager.getInstance().setCustomInAppMessageManagerListener(
    object : DefaultInAppMessageManagerListener() {
        override fun beforeInAppMessageDisplayed(inAppMessage: IInAppMessage?): InAppMessageOperation {
            // TODO: notice you'll need to update the `this@` given here to the actual name of your Application class:
            return Judo.brazeBeforeInAppMessageDisplayed(this@JudoBrazeSampleApplication, inAppMessage) ?: super.beforeInAppMessageDisplayed(inAppMessage)
        }
    }
)

In-App Message Usage

Create a Braze IAM Campaign in the Braze web UI of the HTML Custom View type. Advance through each the below steps by clicking the "Forward" button in the bar at the very bottom of the display.

Creating an IAM Campaign

Braze Create Campaign Menu

Selecting "Custom Code" Message Type

While any of the Message Types should work, we suggest using the Custom Code type. You'll then need to populate the content of the Message with the minimum that Braze requires; note that this will not be shown on to the user, but Braze expects to use its own UI and so requires us to provide some content.

Braze Custom Code Campaign

With the Custom Code type, use the following minimal HTML snippet to satisfy the form validation: <a href="appboy://close">X</a>.

Braze HTML Snippet

Setting the judo-experience Extra

Then, set a custom Extra value on the Campaign with a key of judo-experience. Provide the URL of the Judo Experience you'd like to show here. This is what the Judo-Braze Integration Library will detect in the handler and use to inject your Judo Experience in lieu of the standard Braze IAM UI.

Braze Campaign Extras Configuration

Finishing the Campaign

You will need to complete the campaign, namely setting up a trigger for the Campaign and selecting users via Segments in the Delivery and Target User sections respectively. This is out of scope of this document, so please see Braze's Creating an In-App Message Guide.

Sample Project

In this repository, there is a sample directory that contains an example Android app project using the Judo-Braze integration module, useful for both reference and testing purposes.