Android Getting Started
#
Requirements- Latest stable Android Studio
- Latest Gradle plugin
- Latest NDK
#
Get the client token and configuration fileTo 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 website, 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#
Get the Banuba SDK archiveWith 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 ready 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.
#
Build your project with Banuba SDK- Create
libs
directory in your project and addbanuba_effect_player.aar
withbanuba_sdk.aar
.
- Open build.gradle (Module: app) and add Banuba SDK dependencies for your project
- Add
BanubaClientToken.java
to your project.
- In
Project Structure
checkDeclared Dependencies
Also check our Android Demo app to use some code snippets
Now you can run your project with BanubaSdk on your device
#
Minify the app sizeAfter 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...
).
#
Switching the face search modeThe EffectPlayer xcframework allows you to use different face tracking algorithms for low, medium and high-end device classes.
Face tracking algorithms:
FAST
โ provides higher performance yet lower quality of face tracking.GOOD
โ provides better tracking quality with larger resources usage.MEDIUM
โ special type which uses algorithm with optimal balance of quality and performance.
See more in API reference.
The default settings as seen below are GOOD
for high-end and medium devices and MEDIUM
for others.
You can change the code to force usage of any face tracking mode for the desired group of devices.