肯定有。只需覆盖FirebaseMessagingService.onMessageReceived
并从 Firebase Cloud Messaging 文档中获取通知正文,如下例所示:
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// TODO(developer): Handle FCM messages here.
// If the application is in the foreground handle both data and notification messages here.
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
Log.d(TAG, "From: " + remoteMessage.getFrom());
Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
}
请参阅 Firebase Cloud Messaging 文档以在“覆盖 onMessageReceived”下在 Android 上接收下游消息。