kirtan403 kirtan403 - 3 months ago 22
Android Question

Using string id for notification or converting string id to generate unique int id

In my app I have groups and for each group there can be updates which I am showing in notification. But in database I have group ids as

. So for generating notification for each group, I need a unique
id. So how can I transform
ids to
ids. So that there can be only 1 notification per group and the contents can be appended as there are updates in that specific group.

I have seen while displaying notifications I can supply
as well.

NotificationManager.notify(String tag, int id, Notification notification)

But for that I also need to supply
id. So how this in combination works? Or any way I can rely only on the
id of the notification?


Your (tag, id) combination of notifications to be shown differently should be different. Otherwise the latest one will replace the previous one. So, here you can just use the string id you have as tag if it is unique and use any int id as the combination must be unique.

Ref : (,%20int,