MetricaMessagingService class

com.yandex.metrica.push.firebase

public class MetricaMessagingService extends FirebaseMessagingService

Methods of the class are used to configure simultaneous working push services: AppMetrica Push SDK and Firebase Cloud Messaging. For more information, see Using with Firebase.

Methods

void onMessageReceived(@NonNull final RemoteMessage message)

Called when a push notification is received from Firebase. For more information, see the method description FirebaseMessagingService.onMessageReceived.

void processPush(@NonNull final Context context, @NonNull final RemoteMessage message)

Sends information about push notification to AppMetrica Push SDK. AppMetrica automatically recognizes own messages and processes only them.

void processPush(@NonNull final Context context, @NonNull final Bundle data)

Sends information about push notification to AppMetrica Push SDK. AppMetrica automatically recognizes own messages and processes only them.

Method descriptions

onMessageReceived

public void onMessageReceived(@NonNull final RemoteMessage message)

Called when a push notification is received from Firebase. For more information, see the method description FirebaseMessagingService.onMessageReceived.

Parameters:
message

The instance of RemoteMessage.

processPush

public void processPush(@NonNull final Context context, @NonNull final RemoteMessage message)

Sends information about push notification to AppMetrica Push SDK. AppMetrica automatically recognizes own messages and processes only them.

This method must be called when you simultaneously use AppMetrica Push SDK and Firebase Cloud Messaging.

Parameters:
context The instance of the Context class.
message

The instance of RemoteMessage.

processPush

public void processPush(@NonNull final Context context, @NonNull final Bundle data)

Sends information about push notification to AppMetrica Push SDK. AppMetrica automatically recognizes own messages and processes only them.

This method must be called:
Parameters:
context The instance of the Context class.
message

The instance of the Bundle class. To get it, convert data from RemoteMessage.getData() to Bundle.