Android Kotlin · zero dependencies

Native Android push with the Notibase Kotlin SDK — from an empty Firebase project to a tracked, clickable notification.

1 · Get your Firebase credentials

Android push rides FCM, so Notibase needs a Firebase service account to send on your behalf. If you already use Firebase, skip to step 4. The short version is below — the complete Firebase guide covers project structure, troubleshooting and FCM error codes.

  1. Create a Firebase project

    Open the Firebase console ↗Add project. Any name works; Analytics is optional.

  2. Add your Android app

    Project overview → Android icon → enter your package name (e.g. com.yourco.app — must match applicationId in your build.gradle). Download google-services.json into your app/ module.

  3. Wire the Google services plugin
    // settings-level build.gradle.kts
    plugins { id("com.google.gms.google-services") version "4.4.2" apply false }
    
    // app/build.gradle.kts
    plugins { id("com.google.gms.google-services") }
    dependencies { implementation("com.google.firebase:firebase-messaging:24.1.0") }
  4. Generate the service-account key for Notibase

    Firebase console → ⚙ Project settingsService accountsGenerate new private key. A JSON file downloads — treat it like a password.

  5. Upload it to Notibase

    Console → your app → SettingsGoogle Android (FCM) → upload the JSON. We validate it against FCM before storing it (envelope-encrypted, rotatable keys). The channel flips to ✓ configured.

2 · Install the SDK

// settings.gradle.kts — the SDK is published via JitPack:
dependencyResolutionManagement {
  repositories { maven("https://jitpack.io") }
}
// app/build.gradle.kts
dependencies { implementation("com.github.notibaseorg:notibase-android:0.2.1") }

The SDK is plain Kotlin over platform APIs — zero dependencies, so it can never conflict with your androidx or Firebase versions.

3 · Initialize & register

// Application.onCreate()
Notibase.init(this, clientKey = "ck_live_…")

// Zero-code path: our FirebaseMessagingService is manifest-merged in —
// tokens register and notifications render automatically.

// Own a FirebaseMessagingService already? Forward both callbacks instead:
override fun onNewToken(token: String) = Notibase.registerToken(token)
override fun onMessageReceived(msg: RemoteMessage) =
    NotibaseNotifications.display(this, msg.data, msg.notification?.title, msg.notification?.body)
Android 13+ requires the runtime POST_NOTIFICATIONS permission — request it from your activity; the SDK declares it in the manifest for you.

4 · Click tracking

Notifications rendered by the SDK route taps through a broadcast trampoline and record the open automatically — nothing to wire. They power the Clicked and CTR columns in the console.

One path needs a single line from you: when your app is backgrounded and the payload has a notification block, Android's system tray renders it and delivers the data payload as extras on your launcher activity's intent. Report those:

// launcher activity
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    Notibase.trackOpenFromIntent(intent)
}
override fun onNewIntent(intent: Intent) {
    super.onNewIntent(intent)
    Notibase.trackOpenFromIntent(intent)
}

Foreign notifications are ignored safely — the call is a no-op unless the payload came from Notibase.

5 · Identify, track, inbox

Notibase.identify("user-42", signature)          // see Security → identity verification
Notibase.track("purchase", mapOf("value" to 9.99))
Notibase.inbox { items -> /* render your notification center */ }
Notibase.inboxMarkRead(listOf(itemId))
← Web SDKiOS SDK →