1

I've researched this topic for a little while, but I can't seem to get it. Apparently Google hasn't made an UI for this is what I understand. So here's the question.

I like to send cloud messages to my app users (100k+) occasionally. The users have an option to turn these notifications off which works fine if the app is in foreground.

But for background, Firebase does not give me any way of handling this. The message will always go to the tray even a user has disabled it inside the app. Understandably the notification never makes it to the app.

I've read responses from people that we should send such messages directly from our own servers. Yes, I've got my own servers and I do send a lot of messages to my users directly from the server. I maintain a database of all fcm codes.

But I'm wondering if there's a way of achieving this through the firebase console. It's nice to have all messages in once place e.g. ios and android. Google will also show us statistics which are also important in analysing which notifications are working better.

I've seen a possible answer here, How can I disable firebase notification on android client app, but it looks very unconventional.

Any help would be appreciated.

ibyte
  • 463
  • 4
  • 17

1 Answers1

2

to disable notifications just must add

FirebaseMessaging.getInstance (). UnsubscribeFromTopic ("Topic_Name");

Note: these must be previously subscribed to the Topic

to enable notifications again use this

FirebaseMessaging.getInstance (). SubscribeToTopic ("Topic_Name");
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Wow. I totally overlooked this bit. So I create topics and then subscribe them to the topics. If they turn the notification off the in the app, I can unsubscribe them. Sounds right? I've got 6 different types of notifications, so I guess I'll have to create 6 topics. I'll have a go at coding this tomorrow. Thanks mate. – ibyte Jul 24 '20 at 21:11