universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

OnNotificationClicked and OnNotificationsReceived not getting called in iOS Push #133

Closed abhaykap closed 3 years ago

abhaykap commented 3 years ago

Hello,

We have been using UTNotifications 1.7.3 and Unity 2018.4.26f1

We send a push_id and coins for users in the custom data. Everything works fine for Android. But for iOS, we receive the Push notification on device and clicking it does open the application, but we do not receive OnNotificationsReceived and OnNotificationClicked callback functions.

Our implementation for Android and iOS is common. The setup code is as below: private NotiManager () { Manager notificationsManager = Manager.Instance; notificationsManager.OnSendRegistrationId += SendRegistrationId; notificationsManager.OnNotificationClicked += OnNotificationClicked; notificationsManager.OnNotificationsReceived += OnNotificationsReceived;
}

public void OnNotificationClicked (ReceivedNotification notification)
{
    Debug.LogError("Notification OnNotificationClicked " + notification.title);
    m_clickedNotification = notification;
}

public void OnNotificationsReceived (IList<ReceivedNotification> receivedNotifications)
{
    Debug.LogError("Notification OnNotificationsReceived " + receivedNotifications.Count);
    m_receivedNotifications.AddRange (receivedNotifications);
}

None of the above log statements get printed.

Here is our iOS push paylaod: {'aps': {'sound': 'default', 'badge': 1, 'alert': u'coin 5500 message'}, 'extra_data': "{u'url_action': True, u'coins': 5500, u'push_id': u'5f7aeaa7bdcfeb5715142327', u'id': 0, u'additional_action': {u'count': 5500, u'name': u'send_coins'}}", 'pn_ttl': 86400}

Note: We have been using the UTNotifications since 4-5 years and our code has been migrated to From Unity 5.4 to 5.6 and now 2018. Just noting it here, if we have missed any thing for UTNotification while migrating.