From Google documentation:
Handle notification messages in a backgrounded app
When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the app launcher by default.
But I need to handle tap and forward to my specific activity on my app (when app in background).
class CustomFirebaseMessagingService : FirebaseMessagingService() {
/*-
Call this method only when app is foreground.
*/
override fun onMessageReceived(remoteMessage: RemoteMessage?) {
Method onMessageReceived called only when app is in foreground.