Android notifications only showing first -


i developping instant messaging app, , want show notification when message received .

upon first message, notification pops , there icon in status bar, expected.

after first message, update notification reflects in status bar, notification not pop second time.

i've tried several things such changing notification id, not work need have 1 notification, updated , shown, not several notifications.

i stuck now, please advise.

edit: added code.

if (messagenotifications.isempty()) {         return null;     }      int messagecount = 0;      (messagenotification messagenotification : messagenotifications) {         messagecount += messagenotification.getcount();     }      messagenotification message = messagenotifications.get(messagenotifications.size() - 1);      boolean showtext = false;      notificationcompat.builder notificationbuilder = new notificationcompat.builder(application);     notificationbuilder.setcontenttitle("secure messenger");     notificationbuilder.setcontenttext("secure message");      notificationbuilder.setticker(gettext(message, showtext));      notificationbuilder.setsmallicon(getsmallicon());     notificationbuilder.setlargeicon(getlargeicon(message));      notificationbuilder.setcolor(colormanager.getinstance().getaccountpainter().getaccountmaincolor(message.getaccount()));     notificationbuilder.setstyle(getstyle(message, messagecount, showtext));      notificationbuilder.setcontentintent(getintent(message));      notificationbuilder.setcategory(notificationcompat.category_message);     notificationbuilder.setpriority(notificationcompat.priority_max);     notificationbuilder.setonlyalertonce(false);      notificationmanager.addeffects(notificationbuilder, messageitem);      return notificationbuilder.build(); 

private pendingintent getintent(messagenotification message) {     intent = new intent();     i.setaction(constants.action_specific_chat);     i.addflags(intent.flag_activity_clear_top);     i.addflags(notification.flag_ongoing_event);     i.addflags(notification.flag_no_clear);      i.addflags(intent.flag_activity_new_task);     i.putextra("com.xabber.android.data.user", message.getuser().tostring());     i.putextra("com.xabber.android.data.account", message.getaccount().tostring());     i.setdata((uri.parse("custom://" + system.currenttimemillis())));       return pendingintent.getactivity(application, unique_request_code++, i, pendingintent.flag_cancel_current); } 


Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -