How to create group push for android 4.4.2? -
i want create group push same notification. code works on android 7.0, doesn't worked android 4.4.2.
private static int notification_id = new random().nextint(); private void sendandroidnoticiation(intent[] intents, string title, string text, bitmap image, string group) { if (image == null) image = bitmapfactory.decoderesource(getresources(), r.mipmap.ic_launcher); pendingintent pendingintent = pendingintent.getactivities(this, ++notification_id, intents, pendingintent.flag_one_shot); uri uri = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.ic) .setlargeicon(image) .setcontenttitle(title) .setcontenttext(text) .setsound(uri) .setautocancel(true) .setcontentintent(pendingintent) .setsmallicon(r.drawable.ic) .setcategory(notification.category_event) .setgroupsummary(false) .setgroup(group); notificationmanagercompat mnotifymgr = notificationmanagercompat.from(getapplicationcontext()); mnotifymgr.notify(notification_id, mbuilder.build()); showgroupsummarynotification(mnotifymgr, group); } private void showgroupsummarynotification(notificationmanagercompat notificationmanager, string group) { notificationcompat.builder builder = new notificationcompat.builder(this) .setstyle(new notificationcompat.inboxstyle()) .setnumber(2) .setsmallicon(r.drawable.ic_nim_big_white) .setcategory(notification.category_event) .setgroupsummary(true) .setgroup(group); notification notification = builder.build(); notificationmanager.notify(123456, notification); }
i have seen such questions:
- android: grouped notifications , summary still shown separately on 4.4 , below
- stack notifications in kitkat (api 19) using setgroup() not working
- what purpose of setgroup() in notification.builder?
but did not me.
Comments
Post a Comment