清除未清除GCM令牌的应用程序数据,也不清除GCM订阅主题 [英] Clearing app data not clearing GCM token nor GCM subscribing topics
问题描述
我已经订阅了GCM的主题,当我通过android设置删除所有应用数据时,GCM令牌是相同的,并且主题的GCM通知仍然可用,因此我收到了我不想接收的通知。 / p>
我的问题是:
-
你不仅可以使用工具进行调试,我建议:)
你必须在sharedprefs中保存订阅的主题。如果您在sharedpreferences中没有标记,您应该调用instanceId.deleteInstanceID()
-
instanceId.deleteInstanceID()
-
令牌很少发生变化,但当它发生变化时,您必须重新订阅所有主题。
同时结帐
I had subscribed to topics from GCM and when I removed all app data by android settings, the GCM token is the same and GCM notification on topics are still available, so I get notifications which I don't want to receive.
My questions are:
- How can I get list all of subscribed topics from GCM?
- How can I remove all subscribed topics without knowing their names?
- Should the GCM token be changed after clearing app data or should all subscribed topics be removed automatically in this case?
You can't only you can use tool for debug i suggest :) You have to save subscribed topics for example in sharedprefs. If you don't have token in sharedpreferences you should call
instanceId.deleteInstanceID()
Simply call
instanceId.deleteInstanceID()
Token will change rarely but when it changes you must resubscribe all your topics.
Also checkout this question on SO
TOOL
You can use this tool to debug :)
When i don't subscribe any topic i get something like this:
{
"applicationVersion": "39",
"connectDate": "2016-01-12",
"application": "com.esportlivescore.develop.debug",
"authorizedEntity": "11443413691531",
"connectionType": "MOBILE",
"appSigner": ".................",
"platform": "ANDROID"
}
After i subscribe some topic:
{
"applicationVersion": "39",
"connectDate": "2016-01-12",
"application": "com.esportlivescore.develop.debug",
"authorizedEntity": "11443413691531",
"rel": {
"topics": {
"match-28388-start": {
"addDate": "2016-01-13"
}
}
},
"connectionType": "MOBILE",
"appSigner": ".................",
"platform": "ANDROID"
}
So somple usage. I use Advanced REST Client (plugin for Chrome)
HTTP GET Request
https://iid.googleapis.com/iid/info/<TOKEN>?details=true
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
TOKEN in url : token obtainet from google
key : can be found in Google Developer Console / GCM Console
这篇关于清除未清除GCM令牌的应用程序数据,也不清除GCM订阅主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!