Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Hi @Salalf01, I have added it into AppDelegate and it's worked 馃帀 . but onNotification is called many times when receiving a remote notification.#2428

Description

          Hi @Salalf01, I have added it into AppDelegate and it's worked 馃帀 .
//Still call the javascript onNotification handler so it can display the new message right away
    NSDictionary *userInfo = notification.request.content.userInfo;
    [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo];

But I realized that method onNotification is called many times when receiving a remote notification.
Below is some logs for this issue.

LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "7FD90B6C-E65E-4F13-9F74-897DCBBBB025", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "F86B0E61-1EC6-4FFB-883A-0238746A28B3", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "A692F3D3-0B68-49CA-B6ED-62DF86F5912C", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "F42E9052-7AB6-42D4-AE86-FECFD51AFCC7", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "F4B632FE-EA9B-4F07-A4AF-9950783C027C", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "192B2180-444E-43DB-8219-6A8509C8A514", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "42328E09-F8D2-4FB9-8566-2A5F9FDAD213", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "0922C14F-0E34-4A31-AAFE-CFFCCFC1464E", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "648E7D9E-7D89-46B1-9B2C-2A219AA6566A", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "37A6F699-6DAB-40FD-9480-0A514B3EC8FC", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "F4DCBB5F-A3CA-40C6-B034-573580B88793", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "A935E4AD-F514-441E-B627-3E9044E3AF04", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "1E5B6377-1A60-41F2-8B8A-1343E7B0EFC9", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "E8A05EFB-AE21-41E8-846A-FBE2BE64E53C", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "832FA5F0-5E94-46AE-824E-755D4E7060D3", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "9FECF988-058B-486E-BDFA-89BA81D70562", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "97860E6E-81EA-47F9-A070-EB89E1091114", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "D44CACDB-03FE-4CF5-BB07-43FA4208D682", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "B6740FA3-D45F-48F7-9FA2-5295FF13B099", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "5580E3AE-84F9-4403-99A7-5C0C9AACF5D4", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "80F69289-04EE-4A1E-A49F-99DBEA71C6D3", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "9D9FCCE6-0514-44EB-B34A-33A6F1928A50", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}
LOG  NOTIFICATION: {"action": undefined, "badge": undefined, "data": {"notificationId": "22F38099-FAAD-44AF-A112-1F718839E2DD", "remote": true}, "finish": [Function finish], "foreground": true, "id": undefined, "message": undefined, "reply_text": undefined, "soundName": undefined, "subtitle": undefined, "title": undefined, "userInteraction": false}

Could you please point me to how I can fix this issue? Thank you.

Originally posted by @khoidiep-rayyone in #2185 (comment)

I'm facing the same issue, after adding this lines

NSDictionary *userInfo = notification.request.content.userInfo;
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo];

issue : getting same notification multiple time(4 time).
Anyone can help me regarding the same ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions