Overview
The Rover SDK is broken up into separate modules. Each module contains an Assembler (described below) and a collection of services. A module may also contain models and UI components.
Assemblers
Each Rover module comes with an assembler. Before you can use a module in your
app you need to pass its assembler to the Rover.initialize
method when you
initialize the Rover SDK.
The Assemblers are in effect collections of factories that know how to construct each Rover component. This whole system constitutes a Dependency Injection system and can be reasoned about as such.
Below is an example of initializing the Rover SDK with just the Core module.
Rover.initialize(
CoreAssembler(/* … */)
)
The Rover.initialize
method instantiates the shared Rover instance and gives
each assembler the opportunity to register services to it. After a service has
been registered it can be accessed through the
Rover.sharedInstance.resolve
method. Below is an example of
resolving the LogReceiver
service—defined in the Core module—and
calling its d()
method:
Rover.sharedInstance.resolve(LogReceiver::class.java)?.d("Hello world!")
If you attempt to resolve a service defined in a module whose assembler was not
included when calling Rover.initialize
, the Rover.sharedInstance.resolve
method will return null
.
A list of all the services in each module is included on the detail page for each module.
Module Configuration
Each module’s assembler accepts a set of arguments that can be used to customize its behavior. Below is an example of customizing the core assembler to use a more verbose logging strategy.
Rover.initialize(
CoreAssembler(
chromeTabBackgroundColor = Color.RED
)
)
Details on the customization options for each assembler are listed on each module's detail page.