How maintain GCM push message in Android, its replaced by new one -
my android application receives push notification text messages.if tap push redirects me desired activity latest push message (intent message) want show desired activity corresponding push messages. example if receives 10 push notifications , tap 3rd notification, code redirects me specified activity 10th push notification's message, want show 3rd intent push notification's message.
i know pendingintent.flag_update_current replace intent message, how can redirect corresponding message instead last message?
i have tried following:
intent intent = new intent(this, testactivity2.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); intent.putextra("uid", uid); pendingintent resultpendingintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notificationcompat.builder mbuilder = new notificationcompat.builder( getapplicationcontext()); notification notification = mbuilder .setsmallicon(r.drawable.ic_launcher) .setticker(textmsg) .setwhen(0) .setautocancel(true) .setcontenttitle(textmsg) .setstyle( new notificationcompat.bigtextstyle().bigtext(textmsg)) .setcontentintent(resultpendingintent).setcontenttext(textmsg) .build(); notificationmanager notificationmanager = (notificationmanager) getapplicationcontext() .getsystemservice(context.notification_service); notificationmanager.notify((int) system.currenttimemillis(), notification);
use flag_one_shot
instead , change second parameter in getactivity
set 0. this answer make clear.
Comments
Post a Comment