Skip to content

Install the Android SDK

The library is built by JitPack from the repository’s release tags. Add JitPack to the repositories in settings.gradle.kts:

settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}

An older project that lists its repositories in the root build.gradle adds the same maven { url "https://jitpack.io" } line under allprojects { repositories { … } }.

In your app module:

app/build.gradle.kts
dependencies {
implementation("com.github.MichalTDev:crm-android:v0.5.0")
}

Then sync Gradle. The library brings kotlinx-coroutines-android with it, and nothing else: its HTTP is HttpURLConnection, it reads and writes its JSON itself, and it keeps what it keeps in SharedPreferences.

Copy your app’s key from the App key card on Settings › your app › Developers › Install: app_…, or app_test_… for the test app. The steps in the Install card on that page are for the Flutter SDK. For Android, follow these pages.

  • minSdk 21 or higher. The library is compiled for Java 8 bytecode, with Kotlin 1.9’s API and language version, so an app on Kotlin 1.9 or later can use it.
  • The INTERNET permission. The library’s manifest declares it, and Gradle merges it into yours.
  • R8 needs no rules. The library reads its JSON without reflection.
  • One process. The SDK runs in your app’s main process only: SharedPreferences is not shared across processes. Do not make a Crm in a second process (a :remote service, say).
  • Firebase Cloud Messaging, which stays yours, for pushes (Push).
  • https. What your users install talks to https://app.purrcrm.com over https. On Android 5.0 to 7.0 the SDK’s own connections trust Let’s Encrypt’s root, which those versions lack; http is for a PurrCRM on your laptop only, allowed in a debug build (Network).
  • Play’s Install Referrer library, only if you want links to survive an install (Links). The SDK takes no dependency on it.

The version in the dependency is a release tag (v0.5.0). The library’s CHANGELOG.md lists the releases, and each one says the oldest PurrCRM it works with. To move to a newer release, change the tag and sync.

Against an older PurrCRM, the SDK goes without what that version does not have, and the rest works as before: preferences() answers null, showMessage answers false, links work only under PurrCRM‘s own host. An older SDK against a newer PurrCRM ignores what it does not know.

Every request says which SDK sent it (android) and its version, which is how the overview’s checklist names it (“Android 0.2.0”). Your code reads the same two from the library’s constants in com.crm.sdk (see API at a glance).

Initialise the SDK.