When I removed “click_action”: “FCM_PLUGIN_ACTIVITY” then Ionic 1 app's push brakes

耗尽温柔 提交于 2019-12-11 16:21:34

问题


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"

来源:https://stackoverflow.com/questions/57185440/when-i-removed-click-action-fcm-plugin-activity-then-ionic-1-apps-push-bra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!