I generate notification_key
s as described here.
Suppose that due to some error I fail to store it, so I try to re-register.
This time I receive a 400 error with the message "notification_key already exists"
.
This looks odd, especially compared to registration of a device to GCM, where you can register as many times as you want and always get the same Registration ID with status 200.
Now I can't register again, and I also can't unregister, because I don't have the notification_id
.
Is there any way to get the previously generated notification_key
from GCM?
Or is the only way to register again with a different notification_key_name
?
I can't find any documentation about it but it's now possible to recover a notification_key
for a device group by doing a GET
request to https://fcm.googleapis.com/fcm/notification?notification_key_name=my_notification_key_name with the headers they require: Authorization: key=my_key
, Content-Type: application/json
and project_id: my_id
.
You will get a response like {
"notification_key": "lost_key"
}
But be aware that returned notification_key is not the same as original, but you can use both of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With