BowlerKitBowlerKit

Setup Push Notifications

10/11/2026

Configure Account-profile Firebase Cloud Messaging (FCM) and local notification delivery for Flutter.

Scope

Flutter initializes local notification support for both profiles. FCM/device-token registration is Account-only; Guest mode never initializes FCM or syncs a device token.

1. Configure Firebase

  1. Create/select a project in the Firebase Console.
  2. Enable Firebase Cloud Messaging API (HTTP v1) as required by the current console.
  3. Register Android and iOS apps using the final identifiers in the generated project (the template currently uses com.soewidiputra.flonlate.mobile).
  4. From mobile-app/, run:
firebase login
dart pub global activate flutterfire_cli
flutterfire configure

Select the intended Firebase project/platforms. This updates lib/firebase_options.dart and native Firebase configuration. Re-run it after changing package/bundle IDs; do not copy another app's config.

2. Configure Laravel sending

Generate a Firebase service-account key with messaging permission and store it outside Git at:

admin-panel/storage/app/firebase-auth.json

NotificationSenderService reads exactly that path. The admin panel persists device tokens, notification history, and sends FCM messages from admin workflows.

3. Account registration flow

bootstrap/account_bootstrap.dart initializes Account FCM after the first frame:

  1. Permission is requested according to NotificationConfig (the template uses the onboarding wizard).
  2. Firebase returns the initial token and token-refresh events.
  3. Tokens are stored securely and posted to POST /api/v1/app/device-tokens when a Sanctum token exists.
  4. Foreground messages are displayed through flutter_local_notifications.
  5. Background handlers and app-open events are registered.

Local notification initialization itself requests no permission; the FCM/wizard path owns permission timing.

4. iOS and Android setup

  • Android: add the final google-services.json, notification permissions/channel configuration, and test Android 13+ permission behavior.
  • iOS: configure APNs authentication/capabilities in Firebase, Xcode, and EAS/signing credentials; test on a physical device.
  • Keep the Firebase package/bundle IDs synchronized with android/app, ios/Runner, and firebase_options.dart.

5. Test delivery

  • Complete the Account wizard permission step and confirm an FCM token is stored/synced.
  • Send a test message from Firebase or Laravel admin.
  • Confirm notification history and read/delete actions through /api/v1/app/notifications.
  • Test foreground, background, terminated, denied-permission, token-refresh, logout, and Guest flows.

Notification-open handling currently logs/handles messages at the bootstrap/widget layer; it is not an arbitrary deep-link router. Add an explicit allowlisted navigation contract before trusting payload links.

Relevant files

  • lib/firebase_options.dart
  • lib/config/notification_config.dart
  • lib/helpers/notification.dart
  • lib/helpers/notification_push.dart
  • lib/bootstrap/account_bootstrap.dart
  • lib/services/fcm_service.dart
  • lib/services/notification_history_service.dart