ICHMSMessageService

Service to handle Huawei Mobile Services (HMS) push messages.

Service to handle Huawei Mobile Services (HMS) push messages.

Syntax: class ICHMSMessageService : HmsMessageService

Functions

Function NameDescription
onMessageReceivedCalled when a message is received.
onNewTokenCalled when a new token for the default HMS project is generated.

onMessageReceived

This is also called when a notification message is received while the app is in the foreground.

Syntax: override fun onMessageReceived(message: RemoteMessage)

Parameters

ParametersTypeDescription
messageRemoteMessageRemote message that has been received.

onNewToken

This is invoked after app install when a token is first generated, and again if the token changes.

Syntax: override fun onNewToken(token: String)

Parameters

ParametersTypeDescription
tokenStringThe token used for sending messages to this application instance.