HarmonyOS 鸿蒙Next push 服务端报错 "msg": "All the tokens are invalid"
HarmonyOS 鸿蒙Next push 服务端报错 “msg”: “All the tokens are invalid”
调用 push 接口推送报错
请求报文:
{
"validate_only": false,
"message": {
"android": {
"bi_tag": "{\"channelId\":319,\"pushType\":1,\"taskId\":xxx}",
"collapse_key": -1,
"notification": {
"auto_cancel": true,
"auto_clear": 36000000,
"click_action": {
"intent": "fnfresh://shoppingcart?ref=crm_xxx&phoneType=1&taskId=xxx",
"type": 1
},
"default_sound": false,
"foreground_show": true,
"use_default_light": false,
"use_default_vibrate": false
}
},
"data": "{\"PUSH_DATA\":\"{\\\"phoneType\\\":\\\"1\\\",\\\"ref\\\":\\\"xxx\\\",\\\"taskId\\\":\\\"xxx\\\",\\\"url\\\":\\\"fnfresh://shoppingcart?\\\"}\"}",
"notification": {
"body": "鸿蒙推送",
"title": "鸿蒙推送测试"
},
"token": [
"xxxx"
]
}
}
响应报文:
{
"code": "xxx",
"msg": "All the tokens are invalid",
"requestId": "xxx"
}
2 回复
这个教程里面有详细讲解推送的:https://www.itying.com/goods-1204.html
看下是不是module.json5文件中首页的ability下配置了uris标签,如果配置了的话可能会导致目标页无法匹配,删掉这个uris标签,再试下。参考demo:https://gitee.com/harmonyos_samples/push-kit_-sample-code_-server-demo_-java