Update push notification message in in the notification drawer

55 views
Skip to first unread message

Hannah R

unread,
Mar 10, 2021, 5:02:12 PM3/10/21
to CodenameOne Discussions
Hi,

Is there a way to update a push notification message in cn1? (See the reference - https://developer.android.com/training/notify-user/build-notification#Updating)

Shai Almog

unread,
Mar 10, 2021, 10:25:26 PM3/10/21
to CodenameOne Discussions
Hi,
at the moment we don't have that capability since it's platform specific.

Hannah R

unread,
Mar 11, 2021, 9:45:06 AM3/11/21
to CodenameOne Discussions
Thank you for your response.

However, this raises another question:
How to prevent bombing user with many push notifications? Or with the same notifications? I don't want user to see 10 notifications from the same app in their notification drawer, especially if the messages are the same. 

Javier Anton

unread,
Mar 11, 2021, 5:09:17 PM3/11/21
to codenameone...@googlegroups.com
Sry if I digress, Shai pls feel free to ammend my words

Cn1's push requires you to control this bit of logic server-side. In simple terms, keep a collection of notifications sent in a db somewhere and decide on the server whether new notifs deserve being pushed

Even if you inplemented your own push and not cn1's (not advisable), only on Android would you be able to prevent showing a notification after it has arrived. On iOS, you would still need to make the server choose sending an active or a silent notification

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/d3e3d8ff-1d45-49ee-b75c-e9e2c5382bdan%40googlegroups.com.

Shai Almog

unread,
Mar 11, 2021, 11:30:20 PM3/11/21
to CodenameOne Discussions
You have two options I can think of:
- Keep track of the push messages sent and avoid sending a duplicate.
- Send hidden pushes and use local notification to update the push status

Notice that your pushes are collapsed together so they shouldn't be too noisy for the user even if you have some duplicates.
Reply all
Reply to author
Forward
0 new messages