mugib_sdk_push

Turnkey Firebase Cloud Messaging push for mugib_sdk. One call wires proactive notifications to a Mugib client — so Mujib can reach your users (follow-ups, surveys, campaigns) even when the app is backgrounded or closed.

Firebase is managed centrally by Mujib. Your app bundles no google-services.json / GoogleService-Info.plist, and the Firebase service account never reaches the device — only the non-secret client config is fetched at runtime from Mujib.

Zero config for the developer: you don't paste a Firebase App ID anywhere. enablePush() reads your app's own bundle/package id and Mujib resolves (or auto-registers) the matching App ID in its central Firebase project for you.

Install

dependencies:
  mugib_sdk: ^1.0.38
  mugib_sdk_push: ^1.1.0

Usage

import 'package:mugib_sdk/mugib_sdk.dart';
import 'package:mugib_sdk_push/mugib_sdk_push.dart';

final mugib = MugibClient(apiKey: 'YOUR_KEY');

final push = await mugib.enablePush(
  onForegroundMessage: (m) => showBanner(m.title, m.text),
  onMessageOpenedApp:  (m) => openConversation(),
);

// push.token — the FCM token (already reported to Mujib)
// push.usingMujibProject / push.warning — see "Already using Firebase?" below
// await push.dispose(); — stop listeners

Already using Firebase in your app?

FCM binds to your app's default Firebase project, and only one project can receive push. enablePush() never breaks your Firebase — if a default app already exists, it's reused. But then tokens belong to your project, so check:

if (!push.usingMujibProject) {
  debugPrint(push.warning!); // switch to per-app mode
}

In that case, use per-app mode: paste your Firebase project's service account on the Mujib SDK channel. Mujib then sends through your project — no conflict, no central config needed.

That's it. enablePush():

  1. reads your app's bundle/package id and fetches Mujib's central Firebase config with the App ID resolved automatically for this app,
  2. initializes a dedicated Firebase app,
  3. requests notification permission,
  4. reports the FCM token to Mujib and keeps it fresh,
  5. surfaces incoming messages.

Background / terminated notifications are shown automatically by the OS from the notification payload — no extra code.

Platform setup

  • Android: no Firebase files needed. Ensure your minSdkVersion meets firebase_messaging requirements.
  • iOS: add the Push Notifications capability. Apple requires an APNs Auth Key tied to your app's bundle id, uploaded once to Mujib's Firebase project (done by the Mujib admin).

Chat/voice only?

If you don't need push, just use mugib_sdk — it stays lightweight with no Firebase dependency.

Libraries

mugib_sdk_push
Turnkey Firebase Cloud Messaging push for mugib_sdk.