Nahue
Nahue

Reputation: 321

Create a topic in Firebase from Android

I'm using Firebase Cloud Messaging and I'm trying to create topics programatically from my android app. I cannot find a way to create a topic, but there's this method called subscribeToTopic(String topic) that allows me to subscribe the device to a topic and get it's messages. How can I CREATE a topic from my android app? Is there a way to do it in Java so I can also create topics in my server? Thanks!

Upvotes: 0

Views: 3953

Answers (1)

Nahue
Nahue

Reputation: 321

Solved! When you do FirebaseMessaging.getInstance().subscribeToTopic("newTopic"), if the topic called "newTopic" doesn't exits, it is created and the user is subscribed to that new topic.

Upvotes: 2

Related Questions