- Ask if a device group exists based on its
notification_key_name .
Your second workaround is the way to go. You must save it on your application server, just as you would for storing registration tokens.
- Determining which device tokens (
registration_id ) belong to a device group.
Same as workaround above. You must manage these details on your application server. Responsibility for these details lies with the developer. Accepting the steps if the registration device is removed, you will also have to remove it from the application server.
- Remove device tokens (
registration_id ) from the device group.
I'm not sure what you need here. The documentation contains information about removing registration tokens from a device group:
Add or remove devices from a device group
To add or remove devices from an existing group, send a POST request with the operation parameter set to add or remove , and specify the registration tokens to add or remove.
Note If you remove all existing registration tokens from a device group, FCM will delete the device group.
HTTP POST Request
For example, to add a device with registration ID 51 to appUser-Chris, you would send this request:
{ "operation": "add", "notification_key_name": "appUser-Chris", "notification_key": "APA91bGHXQBB...9QgnYOEURwm0I3lmyqzk2TXQ", "registration_ids": ["51"] }
Response format
A successful request to add or remove a device returns a value of type message_key as:
{ "notification_key": "APA91bGHXQBB...9QgnYOEURwm0I3lmyqzk2TXQ" }
Note : name_of_name is not required to add / remove registration tokens, but it also protects you from accidentally using the wrong notification_key > .Sub>
From the note in the docs above:
Note If you remove all existing registration tokens from a device group, FCM will delete the device group.