首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >离子推送通知操作按钮未显示

离子推送通知操作按钮未显示
EN

Stack Overflow用户
提问于 2020-02-19 16:27:32
回答 1查看 168关注 0票数 0

我正在使用ionic4与推送插件来发送与FCM的推送通知。

我可以发送通知,但由于某些原因,操作按钮不会显示在通知中,只有标题和正文内容才会显示。

以下是我的请求的有效负载:

代码语言:javascript
运行
复制
{
    "to": "eoD5PLNgj3A:APA91bHcrWcEfbEQuKGOozPXtIxO7CrN2Gd993bXcaaHSO8BkOXhwJ4x1o-7SIUEzIUVLxSwcKih1ac0jOkj4Jp8LQZkRiAHAEfRvRGopSAP4JkJVKXoRllxSkAUCAxWGCfUTk3umMsn",
    "registration_ids": null,
    "condition": null,
    "collapse_key": null,
    "content_available": null,
    "mutable_content": null,
    "priority": "high",
    "time_to_live": 900,
    "dry_run": false,
    "data": {
        "title": "New Visitor",
        "message": "Suda Sankara Rao is here to see you at Protoco HQ.\r\n",
        "visit_id": "ae866080-b6af-44cd-944c-6491ae9d2e4b",
        "force-start": 1,
        "visibility": 1,
        "notId": "ae866080-b6af-44cd-944c-6491ae9d2e4b",
        "actions": [{
            "icon": "snooze",
            "title": "Accept",
            "callback": "visit.accept",
            "foreground": false
        }, {
            "icon": "snooze",
            "title": "Reject",
            "callback": "visit.reject",
            "foreground": true
        }]
    },
    "notification": {
        "title": "New Visitor",
        "body": "Suda Sankara Rao is here to see you at Protoco HQ.\r\n",
        "click_action": "visit",
        "badge": null,
        "android_channel_id": null,
        "icon": null,
        "sound": null,
        "tag": "ae866080-b6af-44cd-944c-6491ae9d2e4b",
        "color": null,
        "body_loc_key": null,
        "body_loc_args": null,
        "title_loc_key": null,
        "title_loc_args": null
    }
}

向设备接收以下格式的通知数据:

代码语言:javascript
运行
复制
{
    "title": "New Visitor",
    "message": "Suda Sankara Rao is here to see you at Protoco HQ.",
    "additionalData": {
        "actions": [{
            "callback": "accept",
            "foreground": false,
            "title": "Accept"
        }, {
            "callback": "reject",
            "foreground": true,
            "title": "Reject"
        }],
        "visit_id": "ae866080-b6af-44cd-944c-6491ae9d2e4b",
        "coldstart": false,
        "foreground": true
    }
}

离子信息:

代码语言:javascript
运行
复制
Ionic:

   Ionic CLI                     : 5.4.15 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.8
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.1.2

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 9 other plugins)

推流插件版本:phonegap-plugin-push@2.3.0

我不能弄清楚这个问题。

我正在使用android模拟器来测试通知。

EN

回答 1

Stack Overflow用户

发布于 2020-02-19 18:23:48

我能够识别并解决这个问题。

如果有效负载具有notification对象。操作按钮不可见。

我已经移除并工作得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60295887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档