Adding the SDK and initializing it

Nabla Android SDK installation

⚠️

The Nabla Android SDK is compatible with Android 6 (API Level 23) and higher, so your minSdkVersion should be >= 23.

You also need your compileSdkVersion to be 33 or higher (this doesn't impact your app's minimum Android supported version).

Add the dependency

First add Jitpack repository to your build file if it's not already there:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Then add the desired Nabla dependencies in your app's build.gradle:

implementation 'com.nabla.nabla-android:messaging-ui:1.0.0-alpha20'
implementation 'com.nabla.nabla-android:video-call:1.0.0-alpha20'
implementation 'com.nabla.nabla-android:scheduling:1.0.0-alpha20'

Nabla Android SDK requires AndroidX libraries, if your app still relies on support libs, please migrate to androidx.

🧙🏼

Backward compatibility

Nabla Android SDK is using Java features introduced in Android API Level 26. In order to support older versions, i.e. 23 to 26, you need to enable desugaring in your app by setting isCoreLibraryDesugaringEnabled in the gradle file. Check the Java 8+ API desugaring support guide.

You also need to add vectorDrawables.useSupportLibrary true in your build.gradle file for your app in the defaultConfig section if you target API 23, as mentioned in Vector Drawable compat guide.

Initialize the SDK

To initialize the SDK, first provide your API key in the app manifest:

<?xml version="1.0" encoding="utf-8" ?>
<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.your.package"
>
  <application>

    <meta-data
      android:name="com.nabla.sdk.PUBLIC_API_KEY"
      android:value="YOUR_API_KEY"
    />

    <!-- Rest of your manifest -->

  </application>
</manifest>

Then, you need to initialize the SDK with the desired modules (e.g. NablaMessagingModule, NablaSchedulingModule, etc.) before calling any of the API endpoints. We require doing that when your app starts, in your Application.onCreate method:

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()

        NablaClient.initialize(
            modules = listOf(
                NablaMessagingModule(), // if you want the messaging feature
                NablaVideoCallModule(), // if you want to add video call capabilities
                NablaSchedulingModule(), // if you want the scheduling feature
            )
        )
    }
}

📘

To generate a mobile SDK API key, open your Nabla Console, go to the "Developers" tab, then to the "API keys" section, "Mobile SDK API keys" sub-tab, and click on "Add mobile SDK API key".