Reputation: 352
In our project we use Firebase cloud messaging for push notification and we encountered the problem of duplication of messages. Our process looks as follow:
Xamarin.Firebase.iOS.CloudMessaging 3.1.2
Xamarin.Firebase.iOS.InstanceID 3.2.1
Xamarin.Firebase.iOS.Core 5.1.3
Subscribe user for topic reuqest
POST https://iid.googleapis.com/iid/v1:batchAdd
request body
{
"to" : "/topics/test",
"registration_tokens" : ["..user_registration_token.."]
}
Send notification for topic subscribers request
POST https://fcm.googleapis.com/v1/projects/our_project_id/messages:send
request body
{
"message":
{
"topic":"test",
"notification":
{
"title":"test-6",
"body":"test-6"
}
}
}
POST https://iid.googleapis.com/iid/v1:batchRemove
{
"to": "/topics/test",
"registration_tokens" : ["..user_registration_token.."]
}
But, when user login again and request brand new token, device still received push notifications which are sending to the old token, and if we send notifications by the topic such users received duplicate push notifications.
If we try get information for old token from api method
GET https://iid.googleapis.com/iid/info/token.....
we get response
<HTML>
<HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Internal Server Error</H1>
<H2>Error 500</H2>
</BODY>
</HTML>
Upvotes: 1
Views: 1891
Reputation: 1
try to add ?details=true to your uri. Be sure to use Authorization key in your header. Output expected is
{ "error": "No information found about this instance id." }
or
{
"application": "com.chrome.windows",
"subtype": "wp:http://localhost:8089/#xxx-xx-xx-xx-xx-x",
"scope": "*",
"authorizedEntity": "xxxx",
"rel": {
"topics": {
}
}
},
"platform": "BROWSER"
}
Upvotes: 0