0

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!

AL.
  • 36,815
  • 10
  • 142
  • 281
Nahue
  • 320
  • 2
  • 18
  • Possible duplicate of [How To Create Topic in FCM Notifications](http://stackoverflow.com/questions/37367292/how-to-create-topic-in-fcm-notifications) – AL. Sep 23 '16 at 01:04

1 Answers1

2

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.

Nahue
  • 320
  • 2
  • 18
  • 2
    i already made this but there it is not created until now about more than 12 hours – Sattar Feb 07 '17 at 13:55
  • Unfortunately that's the minimum amount of time for Firebase to create the topic, it sucks but you can't do anything to fix it... – Nahue Feb 08 '17 at 18:44
  • Where in the FIrebase console may i see all the users who are subscribing to a topic(eg "sports") from my android App? – user3833732 Jul 02 '17 at 21:59
  • @user3833732 take a look at this: https://stackoverflow.com/questions/37987821/get-all-subscribed-topics-from-firebase-cloud-messaging – Nahue Jul 03 '17 at 14:12
  • @Nahue I did check it, but it doesnt give me a list of ALL the users presently subscribed to a particular topic, any ideas? – user3833732 Jul 03 '17 at 20:45
  • @user3833732 take into consideration that it takes like 12 hours to a device to get subscribed to a topic, so maybe you're not getting them all because you didn't wait those 12 hours – Nahue Jul 04 '17 at 22:03