universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

OnclickNotification #83

Closed ferranki closed 6 years ago

ferranki commented 6 years ago

Hi Yuriy, I'm having a problems to get data from OnNotificationClicked.. In android is working very well and we don't have any porblems.

But in iOS we can't collect that information.

private void OnNotificationClicked(ReceivedNotification a_notification) { Debug.Log("<<< OnNotificationClicked "); string data; string extCode;

        foreach (string key in a_notification.userData.Keys)
        {
            string value;
            a_notification.userData.TryGetValue(key, out value);
            Debug.Log("---------------------- OnNotificationClicked value" + value);
        }

        a_notification.userData.TryGetValue("extCode", out extCode);
        a_notification.userData.TryGetValue("data", out data);          

        if (extCode == null)
            extCode = "";

        EvaluateExCode(extCode, data);
    }

My quest is.. in xcode when i see the userInfo extCode and data are there.. but when i ty to get there not works..

Would you know tell us what's going on?

Is it possible that it is by json structure that we are sending from the database?

Thank you.

ferranki commented 6 years ago

The problem was related with the format of push notification in ios, when we sent from database. Bad way: { "aps": { "alert": { "title": "${data.title}", "body": "${data.text}" }, "badge": 1, "data": "${data.data}", "sound": "Data/Raw/${data.notification_profile}", "data": "${data.data}", "extCode": "${data.extCode}" }
} Good way: { "aps": { "alert": { "title": "${data.title}", "body": "${data.text}" }, "badge": 1, "data": "${data.data}", "sound": "Data/Raw/${data.notification_profile}" }, "id": "${data.id}", "data": "${data.data}", "extCode": "${data.extCode}" }

yuriy-universal-ivanov commented 6 years ago

Hi @ferranki ,

Sorry for my late reply and I'm glad you've sorted it out. Please let me know if you need any further assistance.

Best regards, Yuriy, Universal Tools team.