title: How to handle click on push notification (Firebase Cloud Messaging)?
body: <p>Firebase Cloud Messaging sends pushes to my app. And they appear in the system tray when the app is closed.</p>
  <p>The task is to open the app and perform some action (like open another fragment for example) when user clicks on the push notification in the tray.</p>
  <p>The problem is I don't know how to override the default behaviour when user clicks on the push notification. Is there some kind of callback, broadcast receiver etc?</p>
  <p><strong>My FirebaseMessagingService</strong></p>
  <pre><code>class FCMHandlerService : FirebaseMessagingService() {
  
      private val intercomPushClient = IntercomPushClient()
  
      override fun onMessageReceived(remoteMessage: RemoteMessage) {
          logd(&quot;onMessageReceived $remoteMessage&quot;)
          val notification = remoteMessage.notification ?: return
          logd(&quot;Remote message body${notification.body} channel id${notification.channelId} message id${remoteMessage.messageId}&quot;)
          
          //you can create here your custom notification when the app receives push being foreground
      }
  
      override fun onNewToken(token: String) {
          super.onNewToken(token)
          logd(&quot;onNewToken $token&quot;)
          instance.sendFirebasePushRegistrationToken(token)
      }
  }
  </code></pre>
  <p><strong>Service in manifest</strong></p>
  <pre><code>        &lt;service
              android:name=&quot;.old.push.FCMHandlerService&quot;
              android:enabled=&quot;true&quot;
              android:exported=&quot;true&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.firebase.MESSAGING_EVENT&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  </code></pre>