android - 如何使用设备 token 发送下行消息

标签 android push-notification huawei-mobile-services huawei-push-notification

查了官方文档,device_token不能用于hms_server发送下行消息。如果我想访问 hms_server,我必须请求另一个 oauth2 token 。这是否意味着 device_token 和 hms_server_token 都应该一直更新,或者只选择像 device_token 这样的一个来发送下行消息?

URL: https://push-api.cloud.huawei.com/v1/appid/messages:send

Request Header: 
Authorization Bear token (need to request from hms_server, the device_token is only used for identify the address of device)

最佳答案

两个device_tokenaccess_token是必须的。 device_token由客户端获取并在 token 更改时更新。改变场景请引用 Docs .access_token有有效期。当access_token获取,返回有效期。一般有效期为一小时。 access_token在有效期内使用,不需要每次更新。

关于android - 如何使用设备 token 发送下行消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69070157/

相关文章:

android - 需要更多了解 android 中的 AsyncTask

android - 无效路径错误 : get the external memory size

Java Android WebRTC提供创建抛出错误和Ice Gathering或trickling没有发生

javascript - ServiceWorker 生命周期和推送通知

react-native - 如何使用 HMS 模拟对华为的立场

android - 可以在华为应用市场上推荐 Flutter 应用吗?

android - 继续计数按钮

java - 自定义通知,如 Inshorts

android - Cordova Android 中的推送通知图标

android - HMS 核心 map 套件在我的 Android 应用程序上根本无法工作