I am currently doing the following with some success, but not fully tested or scaled.
The application uses firebase as the backend, and I add FCM to implement push notifications.
I need groups to handle when a user can be on different devices or on multiple devices.
I save the return value of notification_key and register_id (token) for each device with ie profile
profiles -profile_id -FCM -notification_key:value -registration_ids -device_1_uuid:token_for_device_1 -device_2_uuid:token_for_device_2
When a user first subscribes, there is no data in the FCM node, i.e. no notification_key and no registration_ids
Each time a user subscribes, they connect to their profile_id.
I get the FCM token and then
If there is no notification button (that is, for the first time on any device), I create a group using profile_id as name_iz_i_i_i_i_name and save the return notification_key button.
If there is a notification on the new device (the input or the first entrance to the new device), I see if there is a registration name for the current device, and if not (the first entrance to the new device), add device_uuid: a pair of tokens to the registration_id.
If there is (return sign-on), I delete the saved token from the FCM group and replace the old token in my saved registration identifiers with the just received token.
Now I can tell all the devices used by this user (profile) by sending them to my id_ profile, and I should not skip tokens, because I delete the old ones.
However, I do not know, because the API does not seem to just read the group and tokens, so the groups can be cleared from time to time.
Also, my early code was tapped and I didnβt capture message_key, so now I canβt add, delete or do anything in one of my groups. I hate the idea that I will have to leave the fierce groups lying in the cloud of the fire base forever.
I think FCM should provide more access to the API to help us keep the place clean.