Night & AirSDKContact team

Platform guide · Kotlin

Android integration

Add one local AAR to a Kotlin or Java app. The package includes the native detector for arm64-v8a, armeabi-v7a, x86 and x86_64.

Install the release AAR

Download the Android AAR (21.7 MiB) and copy it into app/libs/. Set your app’s minimum SDK to API 26 or higher. Add the dependency to the app module’s build.gradle.kts.

dependencies {
    implementation(files("libs/nightair-snore-0.1.0.aar"))
}

Analyze one completed part

Call this on a background worker with normalized mono samples in [-1, 1]. Each event gives the start, exclusive end and highest raw model score within that sound interval.

import com.nightandair.sdk.snore.SnoreSession

fun review(samples: FloatArray, rate: Int): SnoreSession.Summary =
    SnoreSession().use { session ->
        session.addPcm(rate, 0L, samples)
        val result = session.finish()
        for (i in 0L until result.eventCount) {
            val event = session.eventAt(i)
            println("${event.startSeconds}–${event.endSeconds}")
        }
        result
    }

Read an overnight recording

Use addPart(sampleRateHz, startFrame, frameCount, reader) for long files. The callback receives a part-relative frame offset, a destination float array and a requested count of up to 16,384 frames. Seek to the offset, fill the destination and return the number of frames supplied. A positive short read is allowed.

Keep the source replayable for the whole call. If it throws an IOException, retry that part before submitting the next one. Track actual start frames across pauses. Your app manages recording, permissions, interruptions and deletion.

Verify the integration

The release AAR ran inside an independent R8-minified app on an Android 8.0 x86_64 emulator. A Kotlin consumer produced the expected eleven intervals on the synthetic sample. Test your target phone’s recorder and decoder with the reference files as part of device qualification.

Next guideNative C / C++