Installation and Initialization
The Rover SDK is a collection of Android libraries written in Kotlin. Instead of a single monolithic library, the Rover SDK takes a modular approach, allowing you to include only the functionality relevant to your application. The SDK is 100% open-source and available on GitHub.
Install the SDK
The first step is to add the library dependencies. We’ll start with a default installation, featuring all of the Rover libraries.
Ensure that you have Rover’s maven repository added to the dependencies
→
repositories
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:core:2.2.7"
implementation "io.rover:notifications:2.2.7"
implementation "io.rover:experiences:2.2.7"
implementation "io.rover:location:2.2.7"
implementation "io.rover:debug:2.2.7"
}
It’s an a-la-carte selection; you can leave off modules (other than the first,
core
, which is always required) that you don’t need for your product. There
are various reasons why you may not want to include all the Rover libraries in
your project. For instance, you can save method count and APK size by leaving
off Rover libraries that you don’t need.
Each of the modules—including their dependent system frameworks— is described in the Modules section.
Initialization
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
with the list of
Assemblers:
Rover.initialize(
CoreAssembler(
accountToken = "YOUR_SDK_TOKEN",
application = this,
urlSchemes = listOf("rv-myapp"),
associatedDomains = listOf("myapp.rover.io")
),
NotificationsAssembler(
applicationContext = this,
notificationCenterIntent = Intent(context, MyNotificationCenterActivity::class.java),
smallIconResId = R.mipmap.my_small_icon,
requestPushToken = { tokenFutureCallback ->
FirebaseInstanceId.getInstance().instanceId.addOnCompleteListener { task ->
tokenFutureCallback(task.result?.token)
}
},
),
ExperiencesAssembler(),
LocationAssembler(),
DebugAssembler()
)
Rover.installSaneGlobalHttpCache(application)
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.
Don’t sweat the parameters for now; they’re in each section of the documentation for each module.