Installation and Initialization

The Rover SDK is an Android library written in Kotlin. The SDK is 100% open-source and available on GitHub.


Install the SDK

The first step is to add the library as a dependency.

Ensure that you have Rover’s maven repository added to the dependenciesrepositories block of your app-level build.gradle:

dependencies {
    // ...
    repositories {
        // ...
        maven {
            url "http://roverplatform.github.io/rover-android/maven"
        }
    }
}

Then add the following to your application-level build.gradle file (not the top level build.gradle, but rather your app-level one) in the dependencies block.

dependencies {
    // ...
    implementation "io.rover:sdk:3.7.1"
}

Initialization

You must initialize the Rover SDK with your account token. In your app’s Application.onCreate method or anywhere else you prefer to put initialization logic (such as a dependency injection framework), call Rover.initialize:

Rover.installSaneGlobalHttpCache(application)
Rover.initialize(this, "<YOUR-SDK-TOKEN>")

Wherever you put it, you need to be certain that Rover is initialized before Android can dispatch an Intent to the app, such as a push notification or deep link open.


Add Rover Host Activity

Add RoverActivity to your AndroidManifest.xml, setting a Material theme such that the toolbar will properly display your brand colours:

<activity
    android:name="io.rover.sdk.ui.containers.RoverActivity"
    android:theme="@style/AppTheme.NoActionBar"
/>

Note that you must use a theme that disables the built-in Android AppBar because our view embeds an explicit Android toolbar. Here’s an example definition for AppTheme above:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/myBrandColorPrimary</item>
    <item name="colorPrimaryDark">@color/myBrandColorPrimaryDark</item>
    <item name="colorAccent">@color/myBrandColorAccent</item>
</style>

Usage

You can start and run the RoverActivity either an experience ID or an experience universal link URL. With either you may pass along a Campaign ID to be included with the tracked Events.

For an Experience ID:

startActivity(
        RoverActivity.makeIntent(this, experienceId = "my-experience-id", campaignId = null)
)

or, for a universal link URL:

startActivity(
        RoverActivity.makeIntent(this, experienceUrl = Uri.parse("https//example.rover.io/slug"), campaignId = null)
)