universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Stack and unstack notifications #65

Open ferranki opened 6 years ago

ferranki commented 6 years ago

I'm having problems grouping and separating notifications, I have several questions:

1-If I do not group the notifications, it groups them together and only leaves one. (Grouping mode = None) on Android. Is this behavior correct? This should not be the (Grouping mode = ALL_IN_SINGLE_GROUP)?

2-If I have the (Grouping mode = None) in Android and send them with different id separates them by id but only leaves the last of each id.

3-If I put the id, it does not matter the (mode) that you have selected that groups them by id.

4-To group by (from user data) how would it be? I do not quite understand the requirement that is requested. The template I was using is: {   "data": {     "title": "$ {data.title}",     "text": "$ {data.text}",     "notification_profile": "$ {data.notification_profile}",     "notification_group_summary": "$ {data.notification_group_summary}",     "id": "$ {data.id}",     "data": "$ {data.data}",     "extCode": "$ {data.extCode}"   } }

I have also tried, directly putting my own id and I have not gotten it either: {   "data": {     "title": "$ {data.title}",     "text": "$ {data.text}",     "notification_profile": "$ {data.notification_profile}",     "notification_group": "hshdn-4",     "id": "$ {data.id}",     "data": "$ {data.data}",     "extCode": "$ {data.extCode}"   } }

In the setting of pluging settings should I put something else?

These things would be easier to understand if the documentation would be detailed. I do not think it will cost so much after having made the xd plugin

Thank you for your attention. captura

yuriy-universal-ivanov commented 6 years ago

Hi @ferranki,

  1. Android often groups notifications from a single application in the lock screen, but usually displays them as separate notifications when expanding the notification panel.

2,3. A notification with the same id always replaces previous one with the same id by design.

  1. I'd recommend you to start with Android docs about this feature: http://www.androiddocs.com/training/wearables/notifications/stacks.html The basic idea is as following: you are completely responsible for grouping notifications. First, you show several notifications with different ids and the same group identifier. They are displayed as separate notifications, as if they had no group set at all. Then you (yourself) create a new notification, called notification group summary, which is explicitly specified as a notification summary for a group. Then all the notifications in this group disappear and only the summary one is displayed instead of them. With UTNotifications, you specify the group summary notifications by adding a user data item with key "notification_group_summary" and any value of your choice, f.e. "true" (the value is ignored anyway). Please note, that the summary notification is just a regular notification, it won't show what other notifications it replaces - it's up to you to make it clear for a customer (f.e. by picking an appropriate text). Different grouping modes use different factors to define a notification group (a custom group specified in a user data "notification_group" key value, a notification profile name or all the notifications in a single group).

To tell the truth, this feature is not the most useful one, and was even removed from the latest Android documentation, so you can consider it to be out of date and not recommended for use. It was mostly designed for wearable devices, such as smart watches on Android, which allow you expanding a group summary notification to review a list of other notifications it replaces (which is important to save little screen space).

Best regards, Yuriy, Universal Tools team.

ferranki commented 6 years ago

Thanks for the explanation. I have tried what you said and I still do not respect the groupings. I leave the format that I used for this case.

{ "data": { "title": "${data.title}", "text": "${data.text}", "notification_profile": "${data.notification_profile}", "notification_group": "${data.notification_group}", "notification_group_summary": "${data.notification_group_summary}", "id": "${data.id}", "data": "${data.data}", "extCode": "${data.extCode}" } }

The log in gamesparks:

{ "@class": ".ScriptMessage", "data": { "title": "Nuevo mensaje de chat", "id": "10", "notification_group": "group_key_mails", "notification_group_summary": true, "text": "ferran te ha enviado un mensaje de chat", "notification_profile": "custom", "sound": "custom", "extCode": "SendChatMessageNotification", "data": "test" } }

This is the correct format? I send two notifications with the same id but in diferents notification_group.

Thanks

yuriy-universal-ivanov commented 6 years ago

I send two notifications with the same id but in diferents notification_group.

Any notifications are replaced with newer notifications with the same id, regardless of the group. It's by design. If you want them to stay separate, use different ids. Please also note, that every group should have only "notification_group_summary" notification.