Subscribing Registered Devices to Topics in Google Firebase

I need to subscribe the devices to certain topics as they are being registered.
I cannot find a way to do it.
For example, whenever a new installation happens, the newly registered device should be subscribed to topic "All".

Thank you
1 person has
this problem