我正在使用ionic4与推送插件来发送与FCM的推送通知。
我可以发送通知,但由于某些原因,操作按钮不会显示在通知中,只有标题和正文内容才会显示。
以下是我的请求的有效负载:
{
"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
}
}向设备接收以下格式的通知数据:
{
"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
}
}离子信息:
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模拟器来测试通知。
发布于 2020-02-19 18:23:48
我能够识别并解决这个问题。
如果有效负载具有notification对象。操作按钮不可见。
我已经移除并工作得很好。
https://stackoverflow.com/questions/60295887
复制相似问题