Mon*_*key 4 firebase firebase-cloud-messaging
假设有人在Firebase Cloud Messaging中创建了一个设备组,是否有办法在notification_key设备组创建后检索现有设备组?
有没有办法notification_key根据通知密钥名称或注册ID 查找?
似乎通知密钥仅在create方法上返回,如果密钥丢失或者保存到数据库时出错 - 则不可能在没有a的情况下向密钥名称添加另一个注册ID,notification_key因为它已经存在.
如果您知道创建它时使用的notification_key_name,则可以检索设备组的notification_key.参考:https://firebase.google.com/docs/cloud-messaging/android/device-group
用这个:
https://android.googleapis.com/gcm/notification?notification??_key_name=your-key-n??ame
Run Code Online (Sandbox Code Playgroud)
参考:https://groups.google.com/forum/#!topic / firebase-talk/ ytovugx8XNs
例如:
let options = {
url: 'https://android.googleapis.com/gcm/notification?notification_key_name=the_name',
method: 'GET',
headers: {
"Content-Type": "application/json",
"Authorization": "key=" + authorizationKey,
"project_id": projectId
}
};
request(options, function (error, response, body) {
if (!error) {
res.json(body);
}
else {
res.json(error);
}
});
Run Code Online (Sandbox Code Playgroud)
我在使用此调用时发现的一件事是返回的notification_key总是不同,但我能够成功使用它来添加或删除registration_ids.
我将从之前的评论中添加一些额外的信息:
| 归档时间: |
|
| 查看次数: |
1986 次 |
| 最近记录: |