Reputation: 3294
<server-key>
JSON Body:
{ "to": "testTopic", "data": { "key1" : "val1", "key2" : true } }
The repsonse in 200 OK but the response body has:
{
"multicast_id": 6098503498585,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results":[
{
"error": "InvalidRegistration"
}
]
}
So the onMessageReceived() is not triggered, neither app in foreground nor in background? Why do I get InvalidRegistration ? What am I missing?
The server key at point 3 is from Firebase Project settings --> Cloud messaging --> Server key
Upvotes: 6
Views: 4959
Reputation: 264
In 4. your JSON requires a preceeding
/topics/
for "to" thus:
{ "to": "/topics/testTopic",....}
Upvotes: 7