Skip to main content

API for using AR cloud in the SDK

AR Cloud is a client-server solution that helps to save space in your application. This is a product used to store AR filters i.e. masks on a server-side instead of the SDK code. After being selected by the user for the first time, the filter is going to be downloaded from the server and then saved on the phone's memory.

Example of using AR cloud

Banuba SDK AR Cloud delivery solution includes the ar-cloud-*.aar library which should be placed into arcloud-android-kotlin/libs directory.

You can find the AR cloud library here: ar-cloud-*.aar.

Follow these steps to configure AR Cloud:

1. Initialization of the ArCloudKoinModule module in Koin


startKoin {
modules(ArCloudKoinModule().module + MainKoinModule().module)

ArCloudKoinModule should be placed before MainKoinModule.

ArCloudKoinModule is the AR Cloud module which should be initialized and placed before MainKoinModule.

MainKoinModule is the Koin module which should be implemented in your application. It is required for configuring AR Cloud dependencies.

2. Configuring of AR Cloud dependencies in DI layer


class MainKoinModule {

val module = module {

single(createdAtStart = true, override = true) {
arEffectsRepository = get(named("backendArEffectsRepository")),
ioDispatcher = get(named("ioDispatcher"))

single(named("arEffectsCloudUuid"), override = true) {

viewModel {
arEffectsRepository = get<ArEffectsRepositoryProvider>().provide()

3. Paste AR Cloud client id value

Paste AR Cloud client id value into strings.xml.


Please ask Banuba representative to provide you with client id for the trial period.

Excluding the mentioned modules in the example.

These are additional important classes:

  • ArCloudMasksActivity - this is the main UI module that configures BanubaSdkManager with dependent UI components.
  • EffectWrapper - is a data class that wraps an effect taken from an AR cloud.
  • EffectsAdapter - an adapter for the RecyclerView component used to populate effects data.
  • EffectsViewModel - the ViewModel component which is responsible for loading and providing the effect data.

You can use all classes mentioned above as examples or implement your own solution.