Hi @Maksym_Khobotin,
Thanks for the clarification! I now understand fully what is happening! Here are the logs from my test:
=== Debug session 1 ===
2019-08-11 15:26:25.488 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: Bundle[{ios-category=kNotificationCategoryNewSignal, google.delivered_priority=normal, google.sent_time=1565526388424, google.ttl=2419200, google.original_priority=normal, messageId=message:F5349594-8AB8-4DEF-8774-29D7163E317E, ios-alert=Л1, ios-badge=1, ios-sound=default, from=960611584456, signalId=C882A24F-48DD-944E-FF98-0D4EA3CBC700, google.message_id=0:1565526388432993%56b7c464f9fd7ecd, message=Л1, BL_APPLICATION_ID=BDCD56B9-351A-E067-FFA4-9EA9CF2F4000}]
2019-08-11 15:28:52.842 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: notificationId: 0
2019-08-11 15:29:56.546 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: Bundle[{ios-category=kNotificationCategoryNewSignal, google.delivered_priority=normal, google.sent_time=1565526599324, google.ttl=2419200, google.original_priority=normal, messageId=message:EFB80473-BB97-4044-92B6-07DE6931D073, ios-alert=Л2, ios-badge=1, ios-sound=default, from=960611584456, signalId=D766E85F-DB30-2431-FFCA-052E784DC600, google.message_id=0:1565526599330682%56b7c464f9fd7ecd, message=Л2, BL_APPLICATION_ID=BDCD56B9-351A-E067-FFA4-9EA9CF2F4000}]
2019-08-11 15:29:56.860 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: notificationId: 1
2019-08-11 15:31:13.982 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: Bundle[{ios-category=kNotificationCategoryNewSignal, google.delivered_priority=normal, google.sent_time=1565526676845, google.ttl=2419200, google.original_priority=normal, messageId=message:56664A5E-304D-46E9-8E2E-9CEA2D5ED139, ios-alert=Л3, ios-badge=1, ios-sound=default, from=960611584456, signalId=EB0F218F-589E-19A9-FF9D-B0B35BF55B00, google.message_id=0:1565526676852475%56b7c464f9fd7ecd, message=Л3, BL_APPLICATION_ID=BDCD56B9-351A-E067-FFA4-9EA9CF2F4000}]
2019-08-11 15:31:14.288 10876-13125/org.helpapaw.helpapaw D/BackendlessFCMService: notificationId: 2
=== Debug session 2 ===
2019-08-11 15:32:42.704 13685-14095/org.helpapaw.helpapaw D/BackendlessFCMService: Bundle[{ios-category=kNotificationCategoryNewSignal, google.delivered_priority=normal, google.sent_time=1565526765602, google.ttl=2419200, google.original_priority=normal, messageId=message:23ADE9B4-B587-40E4-AA1A-968C8E93ACF7, ios-alert=Л4, ios-badge=1, ios-sound=default, from=960611584456, signalId=BDD0DB0F-4C18-E9BF-FFE4-27F6792B3000, google.message_id=0:1565526765606769%56b7c464f9fd7ecd, message=Л4, BL_APPLICATION_ID=BDCD56B9-351A-E067-FFA4-9EA9CF2F4000}]
2019-08-11 15:32:43.121 13685-14095/org.helpapaw.helpapaw D/BackendlessFCMService: notificationId: 0
As you can see notificationId is restarted in each debug session. Looking at the code:
private static AtomicInteger notificationIdGenerator;
The field is static which means its value is kept between instances of BackendlessFCMService. However, when the whole app is killed this field is destroyed, too. So, next time you start the app the counter starts again from 0. This behaviour is not limited to debugging as the app might be killed manually by the user, automatically by the system, etc. Indeed, my tests confirm that manually killing and starting the app resets the counter.
I would suggest using a different mechanism for generating unique notificationIds. As in practice the SDK never updates sent notifications (which is the reason notificationIds exist) you can use a random int or maybe base it on the notification’s timestamp.
Best Regards,
Milen Marinov