Skip to content

Android (Kotlin)

Install

dependencies {
    implementation("com.heysada:nida:0.1.0")
}

Banners, popups and the shopping-app formats for Kotlin Multiplatform apps with Compose (Android, iOS, desktop): splash, stories, carousel, countdown, coupon, lucky draw, floating button, social-proof toast and daily check-in. Every message is drawn from the app’s design, so a new campaign needs no release of the app.

Use it

Nida.configure(
    NidaOptions(
        appKey = "ipk_…",                         // the panel → Keys
        apiUrl = "https://…",                     // where the service serves /sdk/v1
        placements = listOf("home_top", "home_popup"),
        onOpenUrl = { url, _ -> uriHandler.openUri(url) },
        profilesUrl = "https://…",                // optional: where identify's attributes go
        profilesKey = "ppk_…",
    ),
)
Nida.identify(user.id, user.hash)                // nothing is decided until someone is identified
Nida.identify(user.id, user.hash, mapOf("tier" to "gold"))  // to profiles; then decided again

setContent {
    NidaScope(videoPlayer = myPlayer) {          // what shows over the app
        Column { StoriesRow("home_stories"); MessageBanner("home_top"); AppContent() }
    }
}

Nida.event("add_to_cart")                        // messages set to show when this happens
Nida.setPushToken(token, provider = "fcm", platform = "android")

What it does

  • One decide per session for every placement (at most 10). event and screen ask for the messages set to them and add them; what the session shows stays.
  • Formats. A popup is a centre dialog, a bottom sheet or a full page, closed after close_after_seconds when it has one. A splash fills the screen; its skip shows after skip_after_seconds and it closes by itself after duration_seconds. A stories placement (its Shown at once, max_shown, above 1) is a row of rings (StoriesRow, or MessageBanner on it). A floating button sits at its position and moves where the user drags it. A toast shows for a few seconds, once a session.
  • A stories row. Every live story of the placement comes in one decide, best first. A story the user hasn’t seen has a gradient ring (the design’s stories_row region), a seen one is grey and moves to the end; what was seen is kept on the device per user. In Arabic the row starts at the right. A ring opens the viewer over the app (inside NidaScope): progress bars, each page for its time (a video page for its length), a tap on either side to move, a press held to pause, a swipe to the next or previous story (mirrored in Arabic) and a swipe down to close. A story reports its impression when it opens, not when its ring draws.
  • The server decides every claim, play and check-in: the SDK asks, then draws the view the service sends back with the result.
  • Pictures and videos. precache loads a message’s pictures (and warms its videos) before it shows; pass the app’s image loader there. Videos play in the app’s own videoPlayer.
  • Reports (impressions, clicks, dismissals, page views, conversions) are queued on the device and sent in batches.

Develop

./check.sh   # ktlint, detekt, JVM tests (engine + UI), Android build, iOS tests and framework