Embedding Firebase + Appmetrica(iOS)
Written by Kirill Slobodianiuk
Updated over a week ago


It is expected that you’ve already implemented:

Firebase Cloud Messaging SDK

  1. Make sure that you’ve implemented the Firebase Cloud Messaging SDK according to this instruction

Appmetrica SDK

  1. To be notified whenever the token is updated, to send it to the Adjust afterward, supply a delegate conforming to the messaging delegate protocol. You need to send push_token event with {”token”: <registartion_id_here>} event parameter to Appmetrica via Appmetrica SDK method YMMYandexMetrica.reportEvent.

    The following example registers the delegate and adds the proper delegate method:

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { 
print("Firebase registration token: \\(String(describing: fcmToken))")
let dataDict: [String: String] = ["token": fcmToken ?? ""] NotificationCenter.default.post(
name: Notification.Name("FCMToken"),
object: nil,
userInfo: dataDict
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
YMMYandexMetrica.reportEvent("push_token", parameters: dataDict, onFailure: { (error) in
print("DID FAIL REPORT EVENT: %@", message)
print("REPORT ERROR: %@", error?.localizedDescription) }) }

Did this answer your question?