If fcm message contains "notification" section and app is in the background, Notifications delivered to the system tray and data in extras of the intent.
The problem is that I cannot change Importance for this notifications and they always do not show the popup. I fixes this problem for api 26+, i added Notification channel with
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel channel = new NotificationChannel(getString(R.string.default_notification_channel_id), name, importance);
and in the manifest
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
But for the api 25- i cannot find the solutions. The one suggestions are to remove "notification" section and leave only "data", this will allow fcm deliver messages to
onMessageReceived(RemoteMessage remoteMessage)
when app is in background/foreground and I will be able to show my custom notifications.