Install the SDK

  1. Add the App Messaging SDK to your module-level build.gradle (Groovy DSL) or build.gradle.kts (Kotlin DSL) file. The SDK requires Java 11, so set sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11, and add the com.comapi:foundation dependency.
android {
    compileSdk 36

    defaultConfig {
        // ...
        minSdkVersion 21
        targetSdkVersion 36
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
}

dependencies {
    // ...
    implementation 'com.comapi:foundation:1.6.0'
}
android {
    compileSdk = 36

    defaultConfig {
        // ...
        minSdk = 21
        targetSdk = 36
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
}

dependencies {
    // ...
    implementation("com.comapi:foundation:1.6.0")
}
📘

minSdk and Java 11

The SDK's own minSdk is 16, but the current Firebase, Google Play Services, and AndroidX libraries it depends on require 21 or higher. Setting minSdkVersion 21 in your app is the practical floor. The SDK is compiled against Java 11, so your module must also be on Java 11 or your build will fail with Unsupported class file major version.

🚧

Seeing a "Manifest merger" error?

The most common cause is minSdkVersion in your app being lower than the SDK supports. Setting it to 21 (or higher) usually resolves it. If you must support a lower API level, add tools:overrideLibrary="com.comapi" to your <uses-sdk> element — but be aware that Firebase Cloud Messaging will not function below API 21.

  1. The SDK exposes com.google.firebase.messaging.RemoteMessage in its public API (via PushMessageListener.onMessageReceived(RemoteMessage)), so add the Firebase Messaging dependency to the module-level file. Using the Firebase Android BoM (Bill of Materials) keeps all Firebase library versions aligned automatically — you declare one BoM version and leave the individual Firebase artifacts unversioned.
dependencies {
    implementation 'com.comapi:foundation:1.6.0'

    // Firebase
    implementation platform('com.google.firebase:firebase-bom:33.1.0')
    implementation 'com.google.firebase:firebase-messaging'
}
dependencies {
    implementation("com.comapi:foundation:1.6.0")

    // Firebase
    implementation(platform("com.google.firebase:firebase-bom:33.1.0"))
    implementation("com.google.firebase:firebase-messaging")
}
📘

Use the latest BoM

The version above is illustrative — check the Firebase Android release notes for the current BoM and pin to a stable version. Once you specify the BoM, leave individual Firebase libraries unversioned so the BoM resolves them.

  1. Add the Google Services plugin to your project-level (top-level) build file. Recent versions of Android Studio use the Plugin DSL; declare the plugin with apply false here so it can be applied in any module that needs it.
plugins {
    id 'com.google.gms.google-services' version '4.4.2' apply false
}
plugins {
    id("com.google.gms.google-services") version "4.4.2" apply false
}

If your project still uses the legacy buildscript { ... } block instead of the Plugin DSL, the equivalent is:

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.4.2'
    }
}
buildscript {
    dependencies {
        classpath("com.google.gms:google-services:4.4.2")
    }
}
  1. Apply the plugin in your module-level build file (the same file you edited in step 1). This is the step that wires google-services.json into the build.
plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}
plugins {
    id("com.android.application")
    id("com.google.gms.google-services")
}
  1. Copy the google-services.json file from your Firebase project into your app module folder (typically app/google-services.json) — not the project root. The Google Services plugin reads it from this location at build time.
👍

Sync Now

Synchronise your Gradle files (Android Studio: File → Sync Project with Gradle Files) after making any changes.


Next we will...

  • Initialise the SDK with your API Space ID and authentication token provider.
  • Start a session when you obtain a token from your authentication provider.
  • Listen for real-time events and push messages.
  • Call message and profile services.