Firebase setup

Everything Firebase, in one place — what Notibase needs it for, how to set it up from an empty account, and what to do when FCM says no.

Why Firebase at all?

Google is the only route to an Android device's notification tray: every Android push in the world goes through Firebase Cloud Messaging (FCM). Notibase can't bypass that — nor can OneSignal, Braze or anyone else. What Notibase does is send through your Firebase project on your behalf, so:

PlatformNeeds Firebase?Why
Android (native)YesFCM is the only Android push transport.
FlutterYes — both platformsfirebase_messaging issues FCM tokens on Android and iOS; FCM relays to Apple.
iOS (native Swift)NoThe native SDK talks to APNs directly — see the iOS guide.
Web pushNoBrowsers use the open Web Push protocol; Notibase generates the keys for you.

1 · Create the project

  1. New Firebase project

    Open the Firebase console ↗Add project. Name it after your app. Google Analytics is optional and unrelated to push — skip it if you don't want it.

    Already have a Firebase project for this app? Use it; don't create a second one.

  2. Register your Android app

    Project overview → the Android icon → enter the package name. It must match applicationId in app/build.gradle.kts exactly — a mismatch is the single most common cause of "registration token not registered".

    Download google-services.json and drop it in your app/ module directory (not the project root).

  3. Wire the Gradle plugin
    // settings/root 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") }

    Flutter users: run flutterfire configure instead — it registers both platforms and writes firebase_options.dart for you.

  4. Register your iOS app Flutter only

    Skip this on native iOS. For Flutter: project overview → the Apple icon → enter your Bundle ID, download GoogleService-Info.plist, and add it to your Xcode target (Runner → drag in, "Copy items if needed" ticked).

2 · The service-account key (what Notibase needs)

This is the credential that lets Notibase send. It is not the google-services.json from step 1 — that one is a client config that ships inside your app.

  1. Generate it

    Firebase console → ⚙ Project settingsService accounts tab → Generate new private key → confirm. A JSON file downloads.

  2. Treat it like a password

    It grants send rights on your project. Don't commit it, don't paste it in Slack. If it leaks, revoke it in the same screen and generate a new one.

  3. Upload to Notibase

    Console ↗ → your app → SettingsGoogle Android (FCM) → upload the JSON. We validate it against FCM live before storing it, then seal it with envelope encryption (rotatable keys — see Security). The channel flips to ✓ configured.

Notibase uses the modern FCM HTTP v1 API. The old "server key" / legacy HTTP API was shut down by Google — if a competitor still asks you for a server key, that's why yours may have stopped working.

3 · Connect APNs to Firebase Flutter & FCM-on-iOS

If your iOS pushes go through FCM (that's every Flutter app), Firebase needs your Apple key so it can relay to Apple's servers:

  1. Create the APNs auth key at Apple

    Certificates, Identifiers & Profiles → Keys ↗+ → tick Apple Push Notifications service (APNs) → Register → download the .p8 once. Note the Key ID and your Team ID. (Full detail in the iOS guide.)

  2. Upload it to Firebase — not to Notibase

    Firebase console → ⚙ Project settings → Cloud Messaging → your Apple app → APNs Authentication Key → Upload, with Key ID + Team ID.

    Notibase only needs the service-account JSON in this setup; Firebase handles the Apple hand-off.

Native iOS is different. The Swift SDK talks to APNs directly — upload the .p8 to Notibase (Settings → Apple iOS), not to Firebase, and skip Firebase entirely.

4 · Verify it works

  1. Register a device

    Run your app on a real device (emulators can receive FCM, but iOS simulators can't receive APNs). It should appear in the console under Audience within seconds.

  2. Send yourself one

    Console → Send → title + body → Send now. Watch the live preview match what lands on the device.

  3. Read the delivery log

    Messages → your message → deliveries. Every attempt shows the raw FCM response — not a shrug. Tap the notification and the Clicked / CTR columns move.

Troubleshooting

SymptomCause & fix
credentials_invalid when saving the JSON Wrong file — you uploaded google-services.json instead of the service-account key from Project settings → Service accounts.
SENDER_ID_MISMATCH The device token came from a different Firebase project than the service account. Common after switching projects: uninstall/reinstall the app so a fresh token is issued.
UNREGISTERED / address_gone Normal token churn — the app was uninstalled or the token rotated. Notibase marks the device expired automatically and stops counting it as reachable.
Nothing arrives on iOS via Flutter The APNs key isn't on the Firebase side (step 3), or the app was built with a Bundle ID that doesn't match the Firebase Apple app.
Works in foreground, silent in background (Android) Expected: with a notification block, backgrounded apps are rendered by Android's system tray, not your code. Click tracking for that path needs Notibase.trackOpenFromIntent(intent) — see Android → Click tracking.
No notifications at all on Android 13+ The runtime POST_NOTIFICATIONS permission was never requested or was denied. Check your app's system notification settings.

Costs & limits

FCM itself is free and unmetered for notification sends — Firebase's paid tiers cover other products (Firestore, Functions, storage), not messaging. Your Notibase plan governs your send quota; nothing is billed twice.

← Android SDKFlutter SDK →