我正在尝试实施 Firebase 通知。但是我很难找到有关如何从 firebase 通知中检索自定义数据的任何文档。
但是在代码中如何获取自定义键。
我FirebaseMessagingService.onMessageReceived
用来获取消息数据。
@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());
}