Skip to main content

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. 🔥

  1. On developer portal, go to projects and click + New Project.
  2. Enter the name of your project. For example "My First AR App".
  3. Choose a FREE plan.
  4. Under Android App choose + Add App.
  5. 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​

  1. Download the Android package from DeepAR Developer Portal and unzip.
  2. Create the libs directory in you Android Studio project and copy the deepar.aar in that directory.
  3. In the build.gradle speficy the implementation dependency in the dependencies 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:

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.

AndroidManifest.xml
<uses-native-library
android:name="libOpenCL.so"
android:required="false" />

For Pixel devices, you may also need to add this code:

AndroidManifest.xml
<uses-native-library
android:name="libOpenCL-pixel.so"
android:required="false" />