SetGroup () - undefined for type NotificationCompat.Builder?

I like to have a stck type notification for my messaging application which is webapp. My notifications work. But each time a new notification appears, the previous notification disappears and a new one appears. When I googled, I found that setGroup could be used. But I used it, it shows that

setGroup () is undefined for the type NotificationCompat.Builder.

My notification function:

    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);
}
+4
source share
1 answer

I had the same problem, but after several hours and many other problems, I solved it. I assume that you are also using Eclipse, otherwise the solution will be different.

SDK. Android SDK Build-Tools, API20. ADT, : fooobar.com/questions/13274/... , . , , .

eclipse (v4, v7 v13) . , .

. , .

, !

+1

All Articles