如何判断remoteMessage类型

How to judge the remoteMessage type

想知道HmsMessageService传来的remoteMessage是有通知还是无通知的消息数据,如何判断它们的区别?

public class HmsService extends HmsMessageService {

  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
    // Judge if with or without notification.
  }
}

Push Kit 可以根据目标应用程序的状态(运行 在前台或后台)处理消息。如果想让前台的app运行接收通知消息或者数据消息,需要实现onMessageReceived方法。应用收到消息后会进行后续操作。

更多详情,您可以参考this Docs。如果您还有任何问题,请随时与我们联系。