Push notification 多次显示通知图标

Push notification 多次显示通知图标,push-notification,Push Notification,嗨,我正在android中处理推送通知,它工作正常,但问题是状态栏中显示的每个新电子邮件通知都有单独的通知图标。我只想为多封邮件显示一个图标,请给我建议解决方案。我将在下面发布我的代码。提前谢谢你 int icon = R.drawable.app_icon; long time = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager)con

嗨,我正在android中处理推送通知,它工作正常,但问题是状态栏中显示的每个新电子邮件通知都有单独的通知图标。我只想为多封邮件显示一个图标,请给我建议解决方案。我将在下面发布我的代码。提前谢谢你

    int icon = R.drawable.app_icon;
    long time = System.currentTimeMillis();

    NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    Intent notificationIntent;

    if(event.equals("1"))
    {   
    i++;
    try{

    String msg;
    if(!full_name.equals("") || !full_name.equals("null"))
    {
    msg="New ticket created by "+full_name+"";
    }
    else
    {
    msg="New ticket created by client ("+i+")";
    }

    notificationIntent = new Intent(context,Ticket_Tabs.class);
    notificationIntent.putExtra("filter_id","&vis_filter_id=1");        
    notificationIntent.putExtra("title",(String)context.getString(R.string.inbox));
    notificationIntent.putExtra("client_id",client_id);
    notificationIntent.putExtra("dept_id",department_id);
    notificationIntent.putExtra("set_queue","no");
    notificationIntent.putExtra("Ticket_hash",hash);
    notificationIntent.putExtra("Ticket_id",ticket_id); 


    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_NEW_TASK); 

    String x_id = UUID.randomUUID().toString();
    notificationIntent.putExtra("x_id", x_id );
    notificationIntent.setAction(x_id);



    PendingIntent pending_intent =PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);


    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
    .setWhen(time)
    .setContentTitle((String)context.getString(R.string.app_name))  
    .setContentText(msg)
    .setSmallIcon(icon)
    .setAutoCancel(true)    
    .setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND)
    .setContentIntent(pending_intent); 

    Notification notification=notificationBuilder.build();
    notificationManager.notify(i, notification);


    }
    catch(Exception e)
    {
    Log.d("Exception in Notification : ",e.toString());
    }
    }

任何人都可以正确显示任何solutionNotification,但状态栏中的图标会在回答中的NOTIFICATION commented(通知注释)部分显示单个徽标的查找//此徽标的时间数
     int icon = R.drawable.app_icon;
        long time = System.currentTimeMillis();

        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
        Intent notificationIntent;

        if(event.equals("1"))
        {   
        i++;
        try{

        String msg;
        if(!full_name.equals("") || !full_name.equals("null"))
        {
        msg="New ticket created by "+full_name+"";
        }
        else
        {
        msg="New ticket created by client ("+i+")";
        }

        notificationIntent = new Intent(context,Ticket_Tabs.class);
        notificationIntent.putExtra("filter_id","&vis_filter_id=1");        
        notificationIntent.putExtra("title",(String)context.getString(R.string.inbox));
        notificationIntent.putExtra("client_id",client_id);
        notificationIntent.putExtra("dept_id",department_id);
        notificationIntent.putExtra("set_queue","no");
        notificationIntent.putExtra("Ticket_hash",hash);
        notificationIntent.putExtra("Ticket_id",ticket_id); 


        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |Intent.FLAG_ACTIVITY_NEW_TASK); 

        String x_id = UUID.randomUUID().toString();
        notificationIntent.putExtra("x_id", x_id );
        notificationIntent.setAction(x_id);



        PendingIntent pending_intent =PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);


        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
        .setWhen(time)
        .setContentTitle((String)context.getString(R.string.app_name))  
        .setContentText(msg)
        .setSmallIcon(icon)
        .setAutoCancel(true)    
        .setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND)
        .setContentIntent(pending_intent); 

                                           if(i!=0)//THIS ONE FOR THE SINGLE LOGO IN THE NOTIFICATION
                    {
                        notificationBuilder.setPriority(NotificationCompat.PRIORITY_MIN);   
                    }

        Notification notification=notificationBuilder.build();
        notificationManager.notify(i, notification);


        }
        catch(Exception e)
        {
        Log.d("Exception in Notification : ",e.toString());
        }
        }