我是否能够隐藏通过我的 API 从 Firebase 接收到的通知?当前,我通过以下方式在 MyFirebaseMessagingService 中访问通知:
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Intent intent = new Intent(INTENT_FILTER);
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
if (remoteMessage.getNotification().getBody() != null) {
setClientId(remoteMessage);
}
}
private void setClientId(RemoteMessage remoteMessage) {
RemoteMessage.Notification notification = remoteMessage.getNotification();
if (notification.getBody().equals("client_id")) {
putClientIdToSharedPrefs((notification.getTitle()));
}
}
我不想在状态栏中向用户显示消息,我只是想接收消息并保存它。