Android徽章编号未正确更新Android

Android徽章编号未正确更新Android,android,android-notifications,Android,Android Notifications,我在更新应用程序的徽章号码主页图标时遇到问题,我将解释该场景 假设用户A向用户B发送带有通知id A1和i setNumber(count)的消息,假设count是存储在共享首选项上的值,那么在这种情况下,通知后通知标记变为1,将count增加到2,并将count增加到共享首选项中。然后假设用户C向用户B发送带有通知id C1的消息,那么值为2+2(加倍)在徽章上,然后通知徽章自动出现4,需要3,流程如下 设置徽章号码计数的代码 NotificationCompat.Builder

我在更新应用程序的徽章号码主页图标时遇到问题,我将解释该场景 假设用户A向用户B发送带有通知id A1和i setNumber(count)的消息,假设count是存储在共享首选项上的值,那么在这种情况下,通知后通知标记变为1,将count增加到2,并将count增加到共享首选项中。然后假设用户C向用户B发送带有通知id C1的消息,那么值为2+2(加倍)在徽章上,然后通知徽章自动出现4,需要3,流程如下

设置徽章号码计数的代码

      NotificationCompat.Builder summaryBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
            .setContentTitle(title)
            .setContentText(message)
            .setSmallIcon(getNotificationIcon())
            .setColor(context.getResources().getColor(R.color.colorPrimary))
            .setContentIntent(pendingIntent)
            .setVibrate(new long[]{0,500,1000})
           .setGroupSummary(true)
            .setNumber(count)
            .setGroup(jid);
我也用过

       ShortcutBadger.applyNotification(context,notification,AppPref.getUnreadCount()+1);
但两种情况下的结果都是一样的。你能告诉我如何将徽章值重置为零吗

请不要建议使用这些,因为它对我的mi手机不起作用

      try {
        ShortcutBadger.applyCountOrThrow(mContext,0);
    } catch (ShortcutBadgeException e) {
        e.printStackTrace(); //always throws unable to execute badge
        
    }
    try {
        boolean success = ShortcutBadger.removeCount(mContext);
       

    } catch (Exception e) {
        e.printStackTrace(); //always throws unable to execute badge

    }