Skip to main content

Android Legacy Installation

note

This document descrides legacy installation process. Since 1.4.0 Banuba SDK provides platform-specific packages. Packages should be preferred over archives.

Requirements

  • Latest stable Android Studio
  • Latest Gradle plugin
  • Latest NDK

Get the client token and configuration file

To start working with the Banuba SDK in your project, you need to have the client token. To receive the client token please fill in our form on banuba.com, or contact us via info@banuba.com.

Together with the token, you will receive a configuration file config.json which contains the required SDK resources defined by your token. Read more about this in Repack your SDK archive (minify SDK size) section.

note

Before building your project, place your client token inside the file: BanubaClientToken.java

Client token usage example

BanubaClientToken.java
final class BanubaClientToken {
public static final String KEY = "YOUR_TOKEN_HERE";

private BanubaClientToken() {
}
}

Get the Banuba SDK archive

With the client token, you will also receive the Banuba SDK archive for Android which contains:

  • Banuba Effect Player (compiled Android library project with .aar extension),
  • Banuba SDK (compiled Android library project with .aar extension),
  • Effect examples located under effects folder.

Repack your SDK archive (minify SDK size)

The SDK release archive contains all SDK resources by default. They may consume more disk space in the finished build.

To reduce the SDK size please use sdk_repacking.py script provided with the SDK archive.

Please refer to SDK repacking readme in your SDK archive for more info and usage example.

After repacking your SDK archive you can try the usage of external resources. It can additionally reduce the size of the SDK.

Build your project with Banuba SDK

  1. Create the libs directory in your project and add banuba_effect_player.aar with banuba_sdk.aar.

image

  1. Open build.gradle (Module: app) and add Banuba SDK dependencies for your project

image

  1. Add BanubaClientToken.java to your project.

image

  1. In Project Structure check Declared Dependencies

image

  1. Also, check our Android Demo app for some usable code snippets

  2. Now you can run your project with BanubaSdk on your device

Minify the app size

After integration of Banuba SDK libraries banuba_effect_player.aar, banuba_sdk.aar your app size may increase significantly. It may happen if you use an 'android.tools' version earlier than classpath com.android.tools.build:gradle:3.5.0. To minify your app size, update 'android.tools' to a newer version, e.g. classpath com.android.tools.build:gradle:4.0.1. Then rebuild your application and check that "strip" phase exists in the build log (> Task :app:strip...).

Build Demo App

Build the Banuba SDK Demo app

  1. Import the Android project under src folder in Android Studio.
  1. Select needed application for build.
  1. Select Build Variant from the left side menu in Android Studio.
  • Debug build variant allows to properly debug and profile app during its execution.
  • Release build variant allows to test release variant of application (faster performance).

Demo app UI

Android Demo app UI description

  1. FPS Counter and active effect — shows the 3 counters of FPS in real-time and displays active effects. FPS counters:
    • Camera
    • Face Recognition (FRX)
    • Draw
    Effect Info — this block contains the information about audio, video, touches usage and render type of the effect. Can be enabled by longtap on the FPS counters area.
  2. Frame Logger — 1st tap starts FPS log recording, 2nd tap ends FPS log recording. FPS log can be found in logcat output.
  3. Gallery — selection and processing photos from the gallery (continuous photo editing).
  4. Take HQ Photo — takes a high-quality photo (process image).
  5. Switch camera — switches between the front and rear cameras.
  6. Rec NoMask Video — 1st tap starts recording a video from camera, 2nd tap ends it. The recorded video can be found here: /sdcard/Android/data/com.banuba.sdk.demo/cache.
  7. Photo/Video — tap to take a low-quality photo in the Photo mode (5), tap and hold to record a video in the Video mode (5).
  8. Switch mode - switches between the Photo and Video modes. When the Video mode is enabled, you can record videos with control 7.
  9. Effects selection — the slider control that shows all effects in the app.
  10. Add Effects — feature that allows to add new effects into Demo App more quickly using File Manager.
  11. Enable fixed FPS — allows to fix FPS by disabling autoexposition setting.

How to use Add Effects feature in Banuba SDK Demo app

  1. Download a folder with effect via Android Studio to device.
  2. Launch Demo App and tap '+' icon.
  3. Find the effect(s) downloaded in File Manager.
  4. Mark the folder(s) with checkbox and tap 'Select' button.
  5. Effect(s) appear in Demo app right after being added and can be applied.

Visit Getting Started for more examples of Banuba SDK usage for Android.