Class FCMTopicSubscriber


  • public class FCMTopicSubscriber
    extends java.lang.Object
    Handles the topic subscription and unsubscription operations for Firebase Messaging.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.android.gms.tasks.Task<java.lang.Void> subscribeToTopic​(java.lang.String topic)
      Invokes the FCM's subscribeToTopic method which subscribes the deviceToken to the given topic.
      com.google.android.gms.tasks.Task<java.lang.Void> unsubscribeFromTopic​(java.lang.String topic)
      Invokes the FCM's unsubscribeFromTopic method which unsubscribes the deviceToken from the given topic.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FCMTopicSubscriber

        public FCMTopicSubscriber()
    • Method Detail

      • subscribeToTopic

        public com.google.android.gms.tasks.Task<java.lang.Void> subscribeToTopic​(@NonNull
                                                                                  java.lang.String topic)
        Invokes the FCM's subscribeToTopic method which subscribes the deviceToken to the given topic.
        Parameters:
        topic - : Topic to which the app instance is to be subscribed.
        Returns:
        Task which can be used by completion listener to determine whether the subscription completed.
      • unsubscribeFromTopic

        public com.google.android.gms.tasks.Task<java.lang.Void> unsubscribeFromTopic​(@NonNull
                                                                                      java.lang.String topic)
        Invokes the FCM's unsubscribeFromTopic method which unsubscribes the deviceToken from the given topic.
        Parameters:
        topic - : Topic from which the app instance is to be unsubscribed.
        Returns:
        Task which can be used by completion listener to determine whether the subscription completed.