dev.usemoss.moss) over the native libmoss runtime: an index loads
from Moss once and is then queried on the device, with no network call at
query time.
Requirements
- Android 7.0 (API 24) or later
- An arm64-v8a phone or emulator image. The SDK has no x86_64 or 32-bit build.
- Kotlin, or Java with
org.jetbrains.kotlin:kotlin-stdlibadded to the app
Install
The SDK ships as a file AAR on theandroid-sdk-v<version> releases of
usemoss/moss. Download it into your
app module:
app/build.gradle.kts:
INTERNET permission and the R8 rules the SDK needs.
The Android SDK is distributed only as a GitHub release AAR. It is not published
to Maven Central. Add it to your app module: a library module that builds its
own AAR cannot depend on a local AAR.
Quick start
Every blocking call rejects the main thread with aMossException, so call them
from Dispatchers.IO (with kotlinx-coroutines-android) or a background
executor:
loadIndex downloads the index once and caches it in the app’s cache directory,
and every query after that runs on the device. Querying an index that is not
loaded throws MossException.NotFound.
Notes
- Keep one
MossClientper process. A second one cannot start while another is live or still closing. - On a device where the native library cannot load, such as an x86_64 emulator
image, every call throws
MossException. close()returns at once and frees the native client in the background.