Issue
My Android app uses Firebase Cloud Messaging to send data messages, and it's been working fine. Now I'm implementing onDeletedMessages(), but I can't get my test case to call it. The message being sent is:
{
"priority": "high",
"to": "/topics/test",
"time_to_live": 0,
"data": {
"sites": [
{
"plusMD5": "959d4d57d19a2047a2e75fccfb9a1512",
"plus": [
"abcderf:r"
],
"site": "computers"
}
],
"time": 1500660817
}
}
To test:
- Set the device to Airplane Mode
- Send the data message
- Wait a bit (15 seconds or so)
- Turn off Airplane Mode
Now that the device has a network connection again, I'd expect onDeletedMessages() to be called, but it's not. Am I misunderstanding how FCM handles deleted and missed messages, or could something else be going on? Thanks!
Rob
Solution
Interesting..
The docs here : https://firebase.google.com/docs/cloud-messaging/android/receive#override-ondeletedmessages
said that In some situations, FCM may not deliver a message. This occurs when there are too many messages (>100) pending for your app on a particular device at the time it connects or if the device hasn't connected to FCM in more than one month. In these cases, you may receive a callback to FirebaseMessagingService.onDeletedMessages()
So you need to fullfill these 2 conditions :
- Need to send (>100) notification where the device is offline
- Turn on Airplane Mode for more than one month
Answered By - faruk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.