Android SDK
Installation & Quickstart
Add the QwryAI Android SDK to your app and send your agent its first message
Prerequisites
| Requirement | Minimum |
|---|---|
| Android | 7.0 (API 24) |
| Build tools | Android Studio Ladybug (2024.2.1) and JDK 11 |
| Kotlin coroutines | Included with the SDK (kotlinx-coroutines-android 1.9.0) |
| Jetpack Compose | Not required: the SDK works with any UI toolkit |
Installation
// build.gradle.kts (app module)
dependencies {
implementation("com.qwryai:qwryai-sdk:0.1.0")
}// build.gradle (app module)
dependencies {
implementation 'com.qwryai:qwryai-sdk:0.1.0'
}Quick start
- Open the Android SDK channel
In your agent, open Channels and select Manage on the Android SDK card.
Channels › Android SDK › Manage. - Copy your agent ID
On the Setup tab, select Copy on the Agent ID card. The same tab links to the SDK source and a complete example app, and its Install and Quick start cards hold the code below with your agent ID already filled in.
- Switch on Visibility
Open the Overview tab and turn on Visibility. The same tab sets the model and instructions this channel answers with.
Overview › Visibility.
- Choose the channel's actions
The Actions tab controls which of your agent's actions can run in the Android SDK. Turn on any Run client-side code action your app handles; see Client-Side Tools.
Actions: which actions run in the app. - Create a client
import com.qwryai.sdk.Qwry val client = Qwry.create(context, "YOUR_AGENT_ID")contextcan be any AndroidContext, such as anActivityor yourApplication. The SDK keeps only its application context, to store this install's device ID and the signed-in user. Create one client and keep it, for example in yourApplicationclass. - Send your first message
lifecycleScope.launch { val response = client.send("Hello! How can you help me?") { onTextDelta = { delta -> // Runs on a background thread for each piece of text print(delta) } } // The whole answer, once it is complete println(response.message.text) println("Conversation: ${response.conversationId}") }Every call is a
suspendfunction that's safe to start from the main thread. The nextsendcontinues the same conversation; callclient.newConversation()to start another.