Prerequisites

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

  2. Pay specific attention to this part of the instruction, especially to the part about handling silent push notifications

  3. Make sure that images in push notifications are handled properly

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) }) }

Refer to this part of Firebase Push Cloud Messaging documentation for details

Did this answer your question?