I like to have a stck type notification for my message app which is a webapp. My notifications are working..But each time a new notification comes the previous notification dissapears and new one comes. When i googled i found that setGroup can be used. But whe i used it it is showing that
setGroup() is undefined for the type NotificationCompat.Builder.
My notification function is:
public void CreateNotification(String msg)
{
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
R.drawable.icon);
Intent notificationIntent = new Intent(AndroidMobileAppSampleActivity.this, AndroidMobileAppSampleActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(AndroidMobileAppSampleActivity.this, 0, notificationIntent, 0);
NotificationManager notificationManager = (NotificationManager) AndroidMobileAppSampleActivity.this
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification noti = new NotificationCompat.Builder(AndroidMobileAppSampleActivity.this)
.setSmallIcon(R.drawable.icon)
.setTicker("New message from "+msg)
.setWhen(System.currentTimeMillis())
.setContentTitle("Mybuzzin")
.setContentText(msg)
.setContentIntent(contentIntent)
//At most three action buttons can be added
.setAutoCancel(true).build();
noti.defaults |= Notification.DEFAULT_SOUND;
noti.defaults |= Notification.DEFAULT_VIBRATE;
noti.flags |=Notification.FLAG_SHOW_LIGHTS| Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(notifyID, noti);
}