I want to avoid the complexities of managing Device Tokens at the application level
- One user using multiple devices on iOS and Android
- Multiple users subscribed to an application group
Treating #1 and #2 as topics on GCM is obviously an easy solution.
So that I only have to deal with my Application UserIds and GroupIds while sending notifications.
1) When device is registering (iOS/Android), I just subscribe the device to topics ["USER_A", "GROUP_A", "GROUP_B"]
2) When sending a notification, just send to a topic.
However, that means, number of topics = users + groups.
1 million users + 500K groups = 1.5 million topics on GCM
My question is..
- Is there any limit to the number of topics on GCM?
- Is there a better approach to avoid managing device subscriptions without having to deal with its complexities when delivering messages.
For #1:
Nope. As per their blog last December 2015:
We’re now happy to announce that we’re allowing unlimited free topics for your app. This means app developers can place an unlimited number of devices within each topic and create an unlimited number of topics.
As far as I know, there still hasn't been any changes with regards to the number of topics.
For #2:
I think it pretty much depends on your preference. For your use case in #1, I think that Device Group Messaging is the one to use. But since you're aiming to avoid too much complication, I think what you did using Topic Messaging is pretty much it. I actually found this post that kinda discusses what to use between the two, the comments are very enlightening, if you will. :D
Cheers! :)
GCM has removed the limitations on Topics as well as subscriptions
FCM also supports the same
Check This: https://firebase.google.com/docs/cloud-messaging/android/topic-messaging