Is there a way to get an existing notification_key based on a registration id or notification key name?

Assuming a device group has been created in the Firebase Cloud Messaging group, is there a way to get the existing one notification_keyfor the device group after it is created?

Is there a way to search notification_keybased on the name of the notification key or registration ID?

It seems that the notification key is returned only when the method is created, and if the key is ever lost or errors are saved in the database, it would be impossible to add another registration identifier to the key name without notification_keyas it already exists.

+4
source share
2 answers

You can receive a notification for a group of devices if you know the name_of_and_and_name that was used to create it. Link: https://firebase.google.com/docs/cloud-messaging/android/device-group

Use this:

https://android.googleapis.com/gcm/notification?notification‌​_key_name=your-key-n‌​ame

Link: https://groups.google.com/forum/#!topic/firebase-talk/ytovugx8XNs

For instance:

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);
    }
});

One thing I discovered when using this call was that the notification returned was always different, but I was able to successfully use it to add or remove register_ids.

I will add additional information from the comments I made earlier:

  • . - , . , , , .
  • - (. @AL ). register_ids . , . , .
+6

API (notification_key s), . AFAIK, / .

notification_key, .

:

0

Source: https://habr.com/ru/post/1671314/


All Articles