# searchSDK for Android / Kotlin

Android API 26+. Normalized search through your application's HTTPS gateway.

Canonical: https://searchsdk.dev/docs/sdks/android
Markdown: https://searchsdk.dev/docs/sdks/android.md

<a id="install"></a>

## Install from source

Package: `dev.searchsdk:searchsdk-android`, version `0.1.0-alpha.1`. This is an alpha source/local-artifact installation. No public registry release or release tag is assumed.

**Get the source**

```bash
git clone https://github.com/Belweave/searchSDK.git
cd searchSDK
# Record this revision with your application's dependency lock.
git rev-parse HEAD
```

**Build or install the local package**

```bash
cd packages/android
./gradlew publishReleasePublicationToVerificationRepository --no-daemon --max-workers=2
```

Use JDK 21 and Android SDK 36 for the build. Add the generated packages/android/build/repository as a Maven repository in your app, then implementation("dev.searchsdk:searchsdk-android:0.1.0-alpha.1"). This is a local AAR with explicit coroutine and OkHttp dependencies, not a Maven Central release.

<a id="first-search"></a>

## Call your application gateway

First deploy an [application-owned gateway](https://searchsdk.dev/docs/guides/application-gateway). searchsdk.dev hosts a demonstration playground and documentation MCP service; neither is an application gateway for these SDKs.

**SearchExample.kt**

```kotlin
import dev.searchsdk.android.SearchClient
import dev.searchsdk.android.SearchRequest

suspend fun searchExample(
    endpoint: String,
    applicationToken: suspend () -> String?
) {
    val search = SearchClient(endpoint = endpoint, accessToken = applicationToken)
    try {
        val response = search.search(
            SearchRequest("SQLite write concurrency", limit = 3)
        )
        for (result in response.results) println(result.url)
    } finally {
        search.close()
    }
}
```

Invoke from an application-owned coroutine with your exact HTTPS endpoint and application-token callback. In a UI, reuse a client for its owning component's lifetime and close it when that component is finished.

<a id="scope"></a>

## Supported surface and limits

Normalized search through your application's HTTPS gateway.

- Gateway only; retries, fallback and provider-native operations remain on the server.
- Minimum-API and physical-device runtime coverage are not claimed. Coroutine cancellation follows Kotlin's structured concurrency.

Preserve result order, provider-native scores and source provenance. Unknown usage is not zero cost. Cancellation and deadlines cannot undo a request already accepted by a remote system or guarantee exactly-once effects.

<a id="verify"></a>

## Verify without provider keys

**Repository checkout · local checks**

```bash
cd packages/android
./gradlew testReleaseUnitTest assembleRelease lintRelease publishReleasePublicationToVerificationRepository --no-daemon --max-workers=2
./gradlew -p consumer testReleaseUnitTest assembleRelease --no-daemon --max-workers=2
```

29 SDK tests, installed AAR/Maven consumer and three HTTPS instrumentation cases on an Android 16 emulator.

These are deterministic contract and artifact checks. They do not establish live-provider or account-entitlement verification. Read the package README for precise commands, dependencies and runtime coverage.

<a id="next"></a>

## Continue in your language

- [Android / Kotlin package reference](https://github.com/Belweave/searchSDK/tree/main/packages/android#readme): Complete API, errors, streaming, packaging and platform boundaries.
- [Compare SDKs](https://searchsdk.dev/docs/sdks)
- [Gateway protocol and authorization](https://searchsdk.dev/docs/guides/application-gateway)
