Android Subscribe to a topic


Example

Client apps can subscribe to any existing topic, or they can create a new topic. When a client app subscribes to a new topic name, a new topic of that name is created in FCM and any client can subsequently subscribe to it.

To subscribe to a topic use the subscribeToTopic() method specifying the topic name:

FirebaseMessaging.getInstance().subscribeToTopic("myTopic");