B Bubbl Docs

Firebase Setup (iOS)

Bubbl push delivery depends on Firebase Messaging.

1) Add GoogleService-Info.plist

  • Download from Firebase Console
  • Add to iOS app target

2) Configure Firebase once at launch

import FirebaseCore

func application(
  _ application: UIApplication,
  didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
  if FirebaseApp.app() == nil {
    FirebaseApp.configure()
  }
  return true
}

3) Wire APNs and FCM tokens

import FirebaseMessaging
import Bubbl

func application(
  _ application: UIApplication,
  didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
  Messaging.messaging().apnsToken = deviceToken
  BubblPlugin.updateAPNsToken(deviceToken)
}

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
  guard let token = fcmToken, !token.isEmpty else { return }
  BubblPlugin.updateFCMToken(token)
}

4) Delegate ownership

Keep UNUserNotificationCenter.current().delegate = NotificationManager.shared.

If another SDK overrides it, set it back after startup.