Android Topics

Topics are different interests within your app that a user can subscribe to which they can then be messaged about. They can be controlled by users so that the user can customize what they receive notifications about. Example topics would be OptedIntoMarketingMessages, a list of user interests such as football teams or trends.

Subscribing to topics

// Subscribe to a topic
OpenBack.subscribeToTopic("SRHBSRCSG");
// Subscribe to multiple topics
ArrayList<String> topics = new ArrayList<String>();
topics.add("WRTGHGES");
topics.add("HHTTXXVB");
OpenBack.subscribeToTopics(topics);
// Subscribe to a topic
OpenBack.subscribeToTopic("SRHBSRCSG")
// Subscribe to multiple topics
val topics: ArrayList<String> = ArrayList()
topics.add("WRTGHGES")
topics.add("HHTTXXVB")
OpenBack.subscribeToTopics(topics)

Getting the subscribed topics

// Get the list of subscribed topics
List<String> topics = OpenBack.getSubscribedTopics();
// Check if subscribed to a topic
boolean isSubscribed = OpenBack.isSubscribedToTopic("HBSSGREWFD");
// Get the list of subscribed topics
val topics: List<String>? = OpenBack.getSubscribedTopics()
// Check if subscribed to a topic
val isSubscribed = OpenBack.isSubscribedToTopic("HBSSGREWFD")

Unsubscribing to topics

// Unsubscribe from a topic
OpenBack.unsubscribeFromTopic("SRHBSRCSG");
// Unsubscribe from all topics
OpenBack.unsubscribeFromAllTopics();
// Unsubscribe from a topic
OpenBack.unsubscribeFromTopic("SRHBSRCSG")
// Unsubscribe from all topics
OpenBack.unsubscribeFromAllTopics()