# Integrate Luciq on KMP

## Get started in seconds

### Option 1 — Set up with an AI coding agent (recommended)

In your AI editor, paste:

```
Set up Luciq SDK in this project in one shot!
1. Install the Luciq agent skills: `npx luciq-skills install`
2. Setup and authenticate Luciq MCP server to this project
3. Add the Luciq SDK to this project
```

Check the [skills](https://docs.luciq.ai/product-guides-and-integrations/product-guides/ai-features/agent-skills) and [MCP](https://docs.luciq.ai/product-guides-and-integrations/product-guides/ai-features/luciq-mcp-server) docs for more details.

### Option 2 — Install manually

This installation process adds the Luciq KMP library that supports [Bug Reporting](https://www.luciq.ai/product/bug-reporting), [Crash Reporting](https://www.luciq.ai/product/crash-reporting), and [App Performance Monitoring](https://www.luciq.ai/product/app-performance-monitoring) from shared Kotlin code.

{% stepper %}
{% step %}

#### Add the dependency

**Gradle (Android & shared code)**

In your Kotlin Multiplatform module, add the library to `commonMain` so it is available on all targets. The same artifact resolves to the correct variant for each platform:

{% code title="Kotlin (build.gradle.kts)" %}

```kotlin
    sourceSets {
        commonMain.dependencies {
            api("ai.luciq-library:luciq-kmp:x.x.x")
        }
}
```

{% endcode %}

Use the latest version from [Maven Central](https://central.sonatype.com/artifact/ai.luciq/luciq-kmp-library)

**iOS**

In your iOS App project add [LuciqKMP](https://docs.luciq.ai/ios/setup-luciq-for-ios/integrate-luciq-on-ios) dependency. See our iOS integration guide for instructions.[Luciq iOS SDK](https://docs.luciq.ai/ios/setup-luciq-for-ios/integrate-luciq-on-ios)
{% endstep %}

{% step %}

### Initialize the SDK

#### Import Luciq in your code

We recommend placing your Luciq configuration code in a shared module and invoking it from the platform-specific initialization logic within each of your Kotlin Multiplatform applications.

In your `commonMain` Kotlin code:

{% code title="Kotlin (Shared.kt)" %}

```kotlin
import ai.luciq.kmp.modules.LuciqKmp
import ai.luciq.kmp.utils.InvocationEvents

object LuciqDefaults {
    const val APP_TOKEN = "APP_TOKEN"
    val invocationEvents = listOf(InvocationEvents.FloatingButton)
    val logLevel = LogLevel.Debug
   val appVariant:String? = null
}

fun initializeLuciq(configuration: LuciqConfiguration) {
   LuciqKmp.init(configuration)
}
```

{% endcode %}

**Android**

You need an `Application` instance and at least one invocation event:

{% code title="Kotlin" %}

```kotlin
val configuration = LuciqConfiguration(
    androidApplication = application,
    token = LuciqDefaults.APP_TOKEN,
    invocationEvents = LuciqDefaults.invocationEvents,
    logLevel = LuciqDefaults.logLevel,
    appVariant = LuciqDefaults.appVariant
)
Shared.initializeLuciq(configuration)
```

{% endcode %}

**iOS**

On iOS, `LuciqConfiguration` does not take an application parameter:

{% code title="App.swift" %}

```swift
val configuration = LuciqConfiguration(
   token: LuciqDefaults.shared.APP_TOKEN,
    invocationEvents: LuciqDefaults.shared.invocationEvents,
    logLevel: LuciqDefaults.shared.logLevel,
    appVariant: LuciqDefaults.shared.appVariant
)
Shared.initializeLuciq(configuration)
```

{% endcode %}

Replace `APP_TOKEN` with your application token from the [Luciq dashboard](https://dashboard.luciq.ai/dashboard/) (**Settings** → **SDK Integration**).

Initialize the SDK as early as possible in your app lifecycle (e.g. in `Application.onCreate` on Android or `application(_:didFinishLaunchingWithOptions:)` on iOS).
{% endstep %}
{% endstepper %}

### Configuration options

| Parameter                 | Android | iOS | Description                                                       |
| ------------------------- | ------- | --- | ----------------------------------------------------------------- |
| `token`                   | ✓       | ✓   | Your app token (required).                                        |
| `invocationEvents`        | ✓       | ✓   | How the SDK is invoked (e.g. shake, screenshot, floating button). |
| `logLevel`                | ✓       | ✓   | SDK debug log level (e.g. `LogLevel.Debug`).                      |
| `appVariant`              | ✓       | ✓   | App variant (e.g. "beta", "production").                          |
| `androidApplication`      | ✓       | -   | Android `Application` instance (required on Android).             |
| `ignoreAndroidSecureFlag` | ✓       | -   | Whether to ignore FLAG\_SECURE for screenshots.                   |

### Managing permissions

{% hint style="warning" %}
Permissions are required for attachments (images, videos, audio) and some invocation methods. The native Luciq SDK may add or require permissions on each platform.
{% endhint %}

**Android**

Relevant permissions (e.g. storage, microphone) are typically declared by the native Luciq SDK. You can remove any you do not need. If you use **Screenshot** as an invocation event, storage permission may be requested at launch.

**iOS**

Add usage descriptions to your `Info.plist` as required by the native SDK, for example:

* `NSMicrophoneUsageDescription` – for voice notes
* `NSPhotoLibraryUsageDescription` – for image attachments

Permission prompts appear when the user tries to use a feature that needs them (e.g. attaching a photo or recording audio).

### Jetpack Compose (Android)

If your Android app uses **Jetpack Compose**, integrate the native Luciq Compose libraries so the SDK can track Compose screens, user interactions, and screen loading for APM. See [Jetpack Compose Integration](https://docs.luciq.ai/android/set-up-luciq-for-android/integrate-luciq-on-android/jetpack-compose-integration).

### SwiftUI (iOS)

If your iOS app uses **SwiftUI**, use the native Luciq SwiftUI APIs so the SDK can track SwiftUI views and measure screen loading for APM. See [Integrate SwiftUI](https://docs.luciq.ai/ios/setup-luciq-for-ios/integrate-luciq-on-ios/integrate-swiftui).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luciq.ai/kmp/setup-luciq-for-kmp/integrating-luciq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
