When I removed “click_action”: “FCM_PLUGIN_ACTIVIT

2019-08-17 20:08发布

Firebase API push payload from backend :

 {
  "registration_ids": [
    "IKSiok9Zpip5cDcebQ67wc7TnpDuhMAFJm1xdGGI44s48JbXEu5iYa"
  ],
  "notification": {
    "body": "Push Test Facility Category",
    "title": null,
    "icon": "myicon",
    "sound": "mySound",
    "vibrate": 1,
    "Badge": 1,
    "click_action": "FCM_PLUGIN_ACTIVITY"
  },
  "data": {
    "message": "Push Test Facility Category",
    "title": null,
    "b": "22",
    "id": "2",
    "category_name": "Restaurants",
    "h": "1",
    "p": 1,
    "type": "2"
  }
}

fcm.service.ts

fcmListeners() {
    this.firebase.onNotificationOpen().subscribe(async (data: any) => {

      if (data.tap) {// when user tapped the background notification

      } else { // Received in foreground

      }
    });
  }

Can you tell me why the app doesn't open when I used the above payload and app is in the background? This is the behavior on an Android device. But no issues on iOS device.

If I use a firebase console cloud message (i.e. dashboard) then no issues there. i.e. it opens the app even in the background on android device. Any clue?

Note: I use the firebase plugin here.

Update: When I removed this "click_action": "FCM_PLUGIN_ACTIVITY" then it works fine on Ionic 4 apps. But it is not working on Ionic 1 app. Any clue?

Ionic 1: It works with this "click_action": "FCM_PLUGIN_ACTIVITY".

Ionic 4: It works without this "click_action": "FCM_PLUGIN_ACTIVITY"

0条回答
登录 后发表回答