startForeground() 需要创建 NotificationChannel 以便在 Oreo 设备的 Launcher 图标上显示徽章编号 1
如何以编程方式隐藏/禁用它?
因为 Galaxy S8(Oreo) 显示徽章编号 1。而 Android 8.0 模拟器也显示点。
这就是我现在正在做的事情。但是 setShowBadge(false) 不起作用
编辑1:
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationChannel tmpC = new NotificationChannel(id, "basic", NotificationManager.IMPORTANCE_MIN);
tmpC.setShowBadge(false);
manager.createNotificationChannel(tmpC);
Notification notification = new NotificationCompat.Builder(this, id)
.setChannelId(id)
.setAutoCancel(true)
.build();
startForeground(getPackageName().hashCode(), notification);