问题
I'm currently implementing Google Cloud Messaging into my app. Basically my app has categories and I need my users to be notifed about recurring events in those categories.
I decided to use GCM Topics as a simple way to notify all the users subscribed to a specific category (I will have about 200-300 topics).
My question is : Since I don't plan on notifying a single user but instead all users subcribed to a specific topic, is there a point in collecting the registration tokens on my server ? Those ids are not required to send a downstream messages to a topic.
I currently have ~20 000 users
Message sent to GCM Http Connection Server
{
"to": "/topics/category1",
"data": {
"message": "Hello subscribers of category1 !",
}
}
Thank you
回答1:
As it isn't the best practice but technically there is no need to store tokens on your server if you just want to use topic messaging.
You should be aware of these points:
- You can't send a push notification to a specific user anymore.
- You have to handle
onTokenRefresh()
carefully and eachtime you get a new token register the user for all of the desired topics agian. - As topic messaging is a new feature on GCM some of the users with old version of Google Play Services maybe unable to subscribe to topics. See this page.
- Each topic has a limit for maximum number of registered users (1 Million user per topic)
来源:https://stackoverflow.com/questions/33332601/is-there-a-point-in-collecting-registration-tokens-when-using-only-the-gcm-topic