Getting Started
As you follow this tutorial, we recommend using our demo project as a practical reference to assist you in integrating the SDK into your project.
Prerequisites​
Set up DeepAR account​
First thing you need to do is set up DeepAR account on our DeepAR developer portal. Developer portal is used to:
- Download DeepAR SDK.
- Access documentation and examples.
- Manage your projects and app license.
DeepAR License Key​
To deploy your DeepAR Android apps it is required to use DeepAR license key.
🔥 DeepAR offers unlimited FREE licences for testing and small projects. 🔥
- On developer portal, go to projects and click
+ New Project
. - Enter the name of your project. For example "My First AR App".
- Choose a FREE plan.
- Under
Android App
choose+ Add App
. - Enter the App ID under which you plan to deploy your app.
Install​
DeepAR is available as AAR dependency installed via maven server or can be downloaded directly from DeepAR Developer Portal.
Gradle​
Add DeepAR maven server as remote repository
in your Android gradle project: https://sdk.developer.deepar.ai/maven-android-repository/releases/
By default, new Android Studio projects specify Google's Maven repository,
and the Maven central repository
as repository locations in the project's settings.gradle
. Add to that DeepAR maven server.
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
maven {
url "https://sdk.developer.deepar.ai/maven-android-repository/releases/"
}
}
To add a DeepAR dependency to your project, specify a implementation
dependency in the dependencies
block of your module's build.gradle
file.
dependencies {
implementation 'ai.deepar.ar:DeepAR:5.6.4'
}
Direct download​
- Download the Android package from DeepAR Developer Portal and unzip.
- Create the
libs
directory in you Android Studio project and copy thedeepar.aar
in that directory. - In the
build.gradle
speficy theimplementation
dependency in thedependencies
block.
dependencies {
implementation files('libs/deepar.aar')
}
You can read more about adding dependencies to Android Studio projects here.
Switch effects​
AR filters are represented by effect files in DeepAR. You can load them to preview the effect.
Places you can get DeepAR effects:
- Download a free filter pack: https://docs.deepar.ai/deepar-sdk/filters.
- Visit DeepAR asset store: https://www.store.deepar.ai/
- Create your own filters with DeepAR Studio.
Call switchEffect
method to load an AR filter from a file.
License​
Please see: https://developer.deepar.ai/customer-agreement
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.
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" />