The Android SDK
The Android SDK (com.crm.sdk) puts PurrCRM inside your Kotlin app. It talks to PurrCRM and keeps the state. Your app either draws every screen itself, with its own views or Compose, or adds the built-in screens, which draw the messenger and your in-app messages over your app for you.
You add the library, make one Crm in your Application, hand it your signed-in user’s token, and it does the rest:
- In-app messages: banners, posts, carousels and surveys your team writes. The SDK checks in for them, decides which one is due, and hands it to you to draw. What people do with each goes back to PurrCRM.
- The messenger: conversations with your team, replies arriving live, typing and Seen, pictures and files, ratings, a help bot, the user’s tickets and new tickets from your team’s forms, and chats with people who haven’t signed in.
- The help center: your articles, searched and read in the app.
- Product events: the app opening and closing, screens, permission changes, taps on pushes and links, sent in batches by itself, plus events of your own.
- Pushes: it recognises PurrCRM‘s pushes, keeps the unread counts right, and opens the page a tapped push names.
- Links: links that open a place in your app on a phone that has it, through an install too.
- Preferences: which topics people hear about, and how.
What you draw
Section titled “What you draw”Each part gives you state to observe (a StateFlow) and calls to make. The screens are yours:
| The SDK gives you | You draw |
|---|---|
crm.messenger.state | The messenger’s home: open conversations, tickets, articles, the help bot’s opening |
crm.conversation(id).state | A conversation: its parts, the composer, messages sending or failed, the reply line, the rating, the help bot’s buttons |
crm.uploadPicture(...), addPicture, addFile | The picture and file pickers, thumbnails and progress |
crm.tickets | The list of tickets, a ticket, and a new ticket’s form |
crm.help | The help center: collections, search, an article, “Was this helpful?” |
crm.inApp.banner, crm.inApp.next | Banners floating over your app; posts, carousels and surveys |
crm.notices | The inbox of notices, and your bell |
crm.preferences(), crm.offersByPush() | A screen of topics, and the offers-by-push switch |
crm.unread | Badges |
crm.publicApp | Your brand’s colour and logo, and which parts are switched on |
In Compose, a screen collects the state and calls the SDK back:
@Composablefun MessengerButton(crm: Crm, open: () -> Unit) { val unread by crm.unread.collectAsState() BadgedBox(badge = { if (unread > 0) Badge { Text("$unread") } }) { IconButton(onClick = open) { Icon(Icons.Outlined.ChatBubbleOutline, contentDescription = "Messages") } }}Each page in this section starts with what you draw for its part.
Requirements
Section titled “Requirements”- Android 5.0 (API 21) or later. The library is compiled for Java 8 with Kotlin 1.9’s API, so an app on Kotlin 1.9 or later can use it.
- Kotlin coroutines: the library’s one dependency is
kotlinx-coroutines-android. Its calls aresuspendfunctions and its state isStateFlows. - Your PurrCRM address,
https://app.purrcrm.com, and your app’s key, from the App key card on Settings › your app › Developers › Install. - A backend that signs a short token for your signed-in users (Sign users in).
- Firebase Cloud Messaging in your app, for pushes. The SDK brings no Firebase of its own.
Where to start
Section titled “Where to start”The set-up guide walks through the whole thing, PurrCRM‘s side and your app’s. In the app:
- Install the library.
- Initialise it in your
Application. - Sign users in.
- Set up push.
- Turn on the setup check in a debug build: it checks each of these steps on the phone.
- Check it from PurrCRM: the setup checklist on the overview ticks Install the SDK in a build when the first request from your app arrives, and names the SDK it saw (“Android 0.5.0”). Settings › your app › Developers › Install › What your app sees shows what PurrCRM knows of your app.
Then add what you need: links, the messenger, the help center, in-app messages, events, preferences and test mode. API at a glance lists every class and call.