所以我将批量通知推送到多个设备。如果它们不在firebase中,我想从我的数据库中删除设备GFCM令牌。
测试请求:
{"registration_ids": ["fznIum-OIL0:APA91bE9n6gxqVEB3hR0On_TZqH_cOOO7rFyLE5MYbvKXUX3737IonXquZRoHeY1UJf20G4nrahz35p80X8PAPouviYvXgtekAzeDFuwaWyiPI1sFlN1d1wGp5OulXv9wUzHyegeZiih","dsasadadsasdasdasdasdefs","fjb0qTB9ACI:APA91bHvx0pSlq-NuQz-bU70DhL7BXAcd-DqT9YT0ZjYw7R_pkBmr8oe6XdNw8IPlU67d-rXMfRY3mybaO7K5GHo_NH7G-Ya1Ae2xxJP1JIbuuSYomz31y_MPQijFK8w-bZXQ26SWE09"],
"notification":{
"body":"Yoou have a new message from Alice"}}
并回复:
{
"multicast_id": 7971310728176484096,
"success": 1,
"failure": 2,
"canonical_ids": 0,
"results": [
{
"error": "NotRegistered"
},
{
"error": "InvalidRegistration"
},
{
"message_id": "0:1481547993513035%4f9c20964f9c2096"
}
]
}
如何检测哪些registration_ids坏/未注册?
谢谢!
答案 0 :(得分:3)
"结果":按照您在registration_ids中指定的顺序返回响应/错误
答案 1 :(得分:1)
string myString = "dots . dots and .dot";
int index = 4; // one based
char charToTest = '.';
// if index'th character is charToTest:
// 1. the string is long enough
// 2. it has charToTest at Length - index position
if (myString.Length >= index &&
myString[myString.Length - index] == charToTest) {
...
}