Getting Started
Licence Key
To run the DeepAR Android SDK, you first need to sign up and create your DeepAR account. If you haven't done that you can do it here: DeepAR Sign Up.
After you’ve signed up and logged in to DeepAR, you can create your new project.
Go to the Projects
and click the + New Project
button to create a new project.
Choose Add App
for Android App.
For App Name
choose any name you want, and for App ID
set your bundle id.
Read more about Application ID here.
Now just hit Create app
, and you will get your license key
(app key).
Download the DeepAR Android SDK.
Copy the App key
and paste it inside your DeepAR Android SDK
project under "your_license_key_here".
DeepAR Android SDK - Installation
Android platform SDK is distributed as an aar library. Following are the steps to include the library inside your project:
Import the
deepar.aar
file to your application lib folder.In Android Studio open
Project Structure
dialog (File -> Project Structure...).In
Project Structure Dialog
click "+" button and chooseImport .JAR/.AAR package
option then clickNext
.In the following dialog navigate to
deepar.aar
file in your libs directory under theFile name
option then clickFinish
.Close all dialogs and Sync the project. Gradle should automatically offer the option since the
settings.gradle
file has changed and now it should contain the following line:include ':deepar'
Check again Project Structure
if the application module has new dependency to deepar. If not add it manually. Under dependency window click "+" -> Module dependency -> deepar -> click Ok
.
Your appliciations gradle.build
file should also include new entry in the dependencies section:
implementation project(':deepar')
For a quick start on how to use the library check out the provided ExampleApp implementation.
Usage requirements
Platform
DeepAR Android SDK supports devices with Android API level 23 (Android 6.0 Marshmallow) and higher.
Hardware
There are no hard requirements, however, for best performance we recommend the following:
2 GB RAM
Quad Core 1.3 GHz processor
Launch year 2015+
Input
DeepAR SDK supports any 16:9 or 4:3 input image resolutions.
Devices must be equipped with cameras that support at least one of the mentioned resolutions.
Permissions
SDK itself doesn't check for Android permissions but certain ones are required for the library to work correctly. Following are the required permissions:
Camera -
Manifest.permission.CAMERA
External file storage -
Manifest.permission.WRITE_EXTERNAL_STORAGE
Autofocus -
android.hardware.camera.autofocus
Record audio -
android.permission.RECORD_AUDIO
It is the responsibility of user provide required permissions before using the library in the code. Within the ExampleApp
code we provide the utility class PermissionActivity
which implements permission check and request functionalities.
Camera feed
It is the user's responsibility to provide feed from the camera as input for the library. For this purpose, you can use the functionality of CameraGrabber
class that is provided by the library. However, the class has limited functionality and may not fit your use case, therefore the source code for CameraGrabber
has been provided in the example project and user can modify it to their needs.
ProGuard
If you're using ProGuard, include this rule:
-keepclassmembers class ai.deepar.ar.DeepAR { *; }
Android 12+
Android 12 changes the policy of access to native vendor libraries. You can read about it here (see ENFORCE_NATIVE_SHARED_LIBRARY_DEPENDENCIES
).
To ensure all DeepAR features work as expected (especially Background Segmentation), add the following code to your app’s manifest, inside the application tag.
<uses-native-library
android:name="libOpenCL.so"
android:required="false" />
For Pixel devices, you may also need to add this code:
<uses-native-library
android:name="libOpenCL-pixel.so"
android:required="false" />