MetricaHmsMessagingService class
com.yandex.appmetrica.push.hms
public class MetricaHmsMessagingService
Methods of the class are used to configure simultaneous use of the AppMetrica Push SDK and another push service. For more information, see Using with other push services.
Methods
void | onMessageReceived(@NonNull final RemoteMessage message) Called when a push notification comes from Firebase. For more information, see the HmsMessageService.onMessageReceived method description. |
void | onNewToken(@NonNull String token) Called when the system generates a new push token. For more information, see the HmsMessageService.onNewToken(String token method description. |
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. |
void | processToken(@NonNull final Context context, @NonNull final String token) Sends information about a push token to AppMetrica Push SDK. |
boolean | isNotificationRelatedToSDK(@NonNull final RemoteMessage notification) Checks whether the push notification received belongs to the AppMetrica PushSDK. |
void | onMessageReceived(@NonNull final RemoteMessage message) Called when a push notification comes from Firebase. For more information, see the HmsMessageService.onMessageReceived method description. |
void | onNewToken(@NonNull String token) Called when the system generates a new push token. For more information, see the HmsMessageService.onNewToken(String token method description. |
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. |
void | processToken(@NonNull final Context context, @NonNull final String token) Sends information about a push token to AppMetrica Push SDK. |
boolean | isNotificationRelatedToSDK(@NonNull final RemoteMessage notification) Checks whether the push notification received belongs to the AppMetrica PushSDK. |
Method descriptions
onMessageReceived
public void onMessageReceived(@NonNull final RemoteMessage message)
Called when a push notification comes from Firebase. For more information, see the HmsMessageService.onMessageReceived method description.
message | The instance of RemoteMessage. |
message | The instance of RemoteMessage. |
onNewToken
public void onNewToken(@NonNull String token)
Called when the system generates a new push token. For more information, see the HmsMessageService.onNewToken(String token method description.
token | Token used for sending push notifications. |
token | Token used for sending push notifications. |
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.
Call this method when you simultaneously use the AppMetrica Push SDK and HMS.
context | The instance of the Context class. |
message | The instance of RemoteMessage. |
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.
- When you simultaneously use the AppMetrica Push SDK and HMS.
- If you need to change push notification data. If you don't need to change data, use the method processPush(@NonNull final Context context, @NonNull final RemoteMessage message).
context | The instance of the Context class. |
message | The instance of the |
context | The instance of the Context class. |
message | The instance of the |
processToken
public void processToken(@NonNull final Context context, @NonNull final String token)
Sends information about a push token to AppMetrica Push SDK.
This method must be called when you simultaneously use AppMetrica Push SDK and Firebase Cloud Messaging.
isNotificationRelatedToSDK
static boolean isNotificationRelatedToSDK(@NonNull final RemoteMessage notification)
Checks whether the push notification received belongs to the AppMetrica PushSDK.
notification | The instance of RemoteMessage. |
notification | The instance of RemoteMessage. |