简体   繁体   中英

How to display each push notification separately on android device using GCM

I am sending push notification to my phonegap app from server. Its getting delivered successfully, but the problem is if I send multiple notifications old one get overrides. For example at 10:00 AM - Notification 1 Received at 10:01 AM Notification 2 Received
in this Notification 1 Received get overwrite by second message. But I want to show both messages as they important. I googled it and found solution on stackoverflow for same.

GCM message is getting overridden?

but its for android, and I am using phonegap and php to send notification, is there any way to assign that we can retain both messages on user screen.

Thanks in advance.

Your issue is with the payload data you are sending with PHP.

From the documentation at https://developers.google.com/cloud-messaging/http-server-ref#notification-payload-support

tag: Indicates whether each notification message results in a new entry on the notification center on Android. If not set, each request creates a new notification. If set, and a notification with the same tag is already being shown, the new notification replaces the existing one in notification center.

One option is to treat tag as a uniqid , as long as you do not really need to go back and update some unread notifications. If you do need to update a notification, choose an id that works in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM