The following code will clear all notifications for your application, including those created using FCM. You can add this to the onResume method of your main activity:
NotificationManager manager = (NotificationManager) getApplicationContext() .getSystemService(Context.NOTIFICATION_SERVICE); manager.cancelAll();
Usually you cancel the notification by specifying the identifier that you gave it when it was created, however, since FCM creates the notification for you, you cannot know its identifier and therefore must cancel it by canceling all notifications as described above.
source share