如何每次创建Android不同的通知?

时间:2016-05-05 16:33:37

标签: android android-notifications

通知工作通常一个问题是所有通知都转到上一个通知链接。我该如何解决?每个通知都会转到它自己的链接。每条消息通知都会转到他/她的收件箱。我怎么能这样做?

Intent intent_activity_start = new Intent(this,MainActivity.class);
                intent_activity_start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                intent_activity_start.putExtra("links", c.getString("link"));

                PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent_activity_start,PendingIntent.FLAG_UPDATE_CURRENT);

                NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
                builder.setSmallIcon(R.drawable.logo);
                builder.setContentIntent(pendingIntent);
                builder.setAutoCancel(true);
                builder.setLargeIcon(getCircleBitmap(photoStream(c.getString("profile_photo"))));
                builder.setContentTitle("Title");
                builder.setContentText(c.getString("notify"));
                builder.setSound(notificationSound);
                builder.setStyle(new NotificationCompat.BigTextStyle()
                        .bigText(c.getString("notify")));
                if(!c.getString("photo").equals("null")){
                    builder.setStyle(new NotificationCompat.BigPictureStyle()
                            .bigPicture(photoStream(c.getString("photo"))));
                }



                NotificationManager notificationManager = (NotificationManager) getSystemService(
                        NOTIFICATION_SERVICE);
                notificationManager.notify(counter.incrementAndGet(), builder.build());

0 个答案:

没有答案