我正在使用GCM发送推送通知。一切正常。但有时我的用户卸载应用程序,在我尝试发送推送通知后,我收到失败错误
例如,我已将推送通知发送到200.其中 25失败了 3规范并保持成功。
我想从请求失败的数据库中删除ID。但是我无法使用我的数据库进行映射。如何解决这个问题?
还有一点,如果我保留所有失败的ID,并发送连续推送,那么谷歌会采取任何行动或阻止我的帐户吗?
请帮帮我。
先谢谢。
{"multicast_id":8019827747662309947,"success":203,"failure":110,"canonical_ids":5,"results":
[
{"registration_id":"APA91bE6fQmRZYCali6WQVkNdMpjo0RG0p4J6YfAEmrqAnRHbMTunEfUBB8DiJ3TwC6IEvTFVRKwzTc6ugnrYaFcPaxfxiLXiUDDh0pCdDxbyKTRwaLS167Po_FYKvcYEmWkiMc-HimweQ557SrGFiAKDMbhcEgWFu9beNkOAqHwmlBccbXJsaw","message_id":"0:1417935604786234%0ba8b24cf9fd7ecd"},
{"error":"NotRegistered"},
{"registration_id":"APA91bEZgM7DZd_78gE4HbrDa2fvcN7F2yH-p4iDQbzryqkMu7k-DsvgluZh06H_rlpczAV0wta0fUofqS2p4HJHvn-vMn8X4FFA633K-AnIwIQcX52u6nCBVlTK5tSoFyKAoyw0_JepbLO5Yi4tg35vGk5eSaH14Q","message_id":"0:1417935604785344%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793003%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604787950%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604792619%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784886%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784870%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604783830%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604782887%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793008%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604794867%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604783802%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604783800%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604784663%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604785422%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604783959%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604786992%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604784882%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784866%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784884%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784868%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604784880%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604783961%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604794871%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604785485%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604784888%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604786979%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604786985%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604794962%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604787954%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604783828%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604797999%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798123%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604787945%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789960%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604785483%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604787952%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604788700%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604788969%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604786983%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604796876%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604786989%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798913%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604787948%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604788971%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604790954%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604797737%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604790746%0ba8b24cf9fd7ecd"},{"registration_id":"APA91bEZgM7DZd_78gE4HbrDa2fvcN7F2yH-p4iDQbzryqkMu7k-DsvgluZh06H_rlpczAV0wta0fUofqS2p4HJHvn-vMn8X4FFA633K-AnIwIQcX52u6nCBVlTK5tSoFyKAoyw0_JepbLO5Yi4tg35vGk5eSaH14Q","message_id":"0:1417935604786987%0ba8b24cf9fd7ecd"},{"registration_id":"APA91bEZgM7DZd_78gE4HbrDa2fvcN7F2yH-p4iDQbzryqkMu7k-DsvgluZh06H_rlpczAV0wta0fUofqS2p4HJHvn-vMn8X4FFA633K-AnIwIQcX52u6nCBVlTK5tSoFyKAoyw0_JepbLO5Yi4tg35vGk5eSaH14Q","message_id":"0:1417935604786981%0ba8b24cf9fd7ecd"},{"registration_id":"APA91bEZgM7DZd_78gE4HbrDa2fvcN7F2yH-p4iDQbzryqkMu7k-DsvgluZh06H_rlpczAV0wta0fUofqS2p4HJHvn-vMn8X4FFA633K-AnIwIQcX52u6nCBVlTK5tSoFyKAoyw0_JepbLO5Yi4tg35vGk5eSaH14Q","message_id":"0:1417935604786977%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604788698%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604788531%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604786991%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604790960%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604788300%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604792996%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800742%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798919%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604789897%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604799772%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604798917%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604792997%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604794964%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604796192%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604795473%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793000%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789895%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604790956%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789507%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789893%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789899%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604789901%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604789958%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604791828%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604798911%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604793002%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794647%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604792994%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604789751%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604789962%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604793010%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604793006%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604791826%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604790962%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794875%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604790958%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793930%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793961%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604791517%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604793963%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798902%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604793943%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799897%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604797991%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604797997%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604798001%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802426%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604792574%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604795765%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796916%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796803%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604799943%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793958%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793932%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793941%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604796914%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604793965%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794869%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798904%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798003%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796784%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604802990%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604798017%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604794873%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604796801%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794960%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796878%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604797993%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604794649%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604803948%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604796765%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796796%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796799%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794983%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798009%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796761%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604797986%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799771%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604795445%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798007%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604796805%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604795985%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798739%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604794966%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604795980%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604795982%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798011%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798005%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799937%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604797989%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799892%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604797995%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604795984%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799901%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604804602%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604798921%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604805966%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800946%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798915%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802008%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604798725%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604798015%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604798013%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604799888%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799769%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799890%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800875%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604799941%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799899%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604800877%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"message_id":"0:1417935604801966%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604805961%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799938%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604808935%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800743%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604799583%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604809415%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604802012%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802423%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604805964%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604809528%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802002%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802984%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802986%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800881%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801964%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801974%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801968%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604810609%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800948%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801822%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604800879%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801970%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801976%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802006%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802000%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604801972%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802004%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802980%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802285%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802425%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802009%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604803705%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604808933%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604803946%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604802988%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604803230%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604805960%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604804532%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604808794%0ba8b24cf9fd7ecd"},{"error":"NotRegistered"},{"error":"NotRegistered"},{"message_id":"0:1417935604806484%0ba8b24cf9fd7ecd"},{"message_id":"0:1417935604803944%0ba8b24cf9fd7ecd"}
]
}
答案 0 :(得分:1)
错误到注册ID的映射基于订单。如果您的请求的注册ID为10 20 30 40,并且Google的响应显示第2和第4个ID的错误,则您知道这些错误是指您发送的注册ID数组中的第2个和第4个ID(即20和40) )。
正如GCM文档中的示例所示,如果这是您的请求:
{ "data": {
"score": "5x1",
"time": "15:10"
},
"registration_ids": ["4", "8", "15", "16", "23", "42"]
}
这是你的回复:
{ "multicast_id": 216,
"success": 3,
"failure": 3,
"canonical_ids": 1,
"results": [
{ "message_id": "1:0408" },
{ "error": "Unavailable" },
{ "error": "InvalidRegistration" },
{ "message_id": "1:1516" },
{ "message_id": "1:2342", "registration_id": "32" },
{ "error": "NotRegistered"}
]
}
您知道第2(8),第3(15)和第6(42)个ID失败,第5个ID(23)返回了规范的注册ID。
关于在多次发送具有相同错误注册ID的邮件时是否存在任何制裁 - GCM文档中没有相关文档,但我认为保持数据库清理垃圾符合您自己的最佳利益。它会为您的服务器节省一些无用的工作(将消息发送到无效的ID),保持您的数据库更小(即使它只是一个小的差异),并给你一个很好的估计使用你的应用程序的用户数。