1

I have a problem regarding the click action of the FCM Push notification when an app is on background. When I try to send a notification from the firebase console, the information is received and if I click the notification, the apps open. But when I try to send a notification via Postman. the notification is also received but when I click it, the app doesn't open.

Payload:

{
    "to": "--mytoken--",
    "notification": {
        "click_action": "home",
        "title": "Title Notification",
        "body": "Body Notification"
    },
    "data": {
        "body": "Body of Your Notification in Data",
        "title": "Title of Your Notification in Title",
        "type": "edit_profile",
        "id_reference": "0",
        "badger": "1",
        "inbox_subject": "",
        "news_title": "YYY",
        "url": "https://yamie2.co.id/news/webview/3",
        "icon": "https://yamie.co.id/images/icon.png"
    }
}

I create an android app with ReactJS and Capacitor

Toto Prasetyo
  • 148
  • 1
  • 6
  • In the Postman case, you are responsible for creating the notification. By default, a notification will display the app when it is clicked on. But you can override this by calling `.setContentIntent(pendingIntent)` when you create the notification. Are you calling `setContentIntent`? Please update your question to include how you are creating the notification. – Edmund Johnson Nov 04 '22 at 11:17
  • @EdmundJohnson, I am not creating the notification manually, all notifications are created by FCM SDK – Toto Prasetyo Nov 14 '22 at 06:27

1 Answers1

0

Make sure you the activity that you want to open has an intent filter with home set to that action.

See also:

Yuji Bry
  • 304
  • 8