请问MyGroupId指的是什么?

用户1446922
2024-08-08 08:06 31 1

MyGroupId指的是什么,怎么获取?

null
private void initChannel(){if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (nm != null){NotificationChannelGroup notificationChannelGroup = new NotificationChannelGroup("MyGroupId", "自定义通知组");
nm.createNotificationChannelGroup(notificationChannelGroup);

            NotificationChannel notificationChannel = new NotificationChannel("MyChannelId", "自定义通知", NotificationManager.IMPORTANCE_HIGH);
            notificationChannel.setGroup("MyGroupId");
            notificationChannel.enableLights(true);
            notificationChannel.enableVibration(true);
            notificationChannel.setSound("android.resource:// 包名 /raw/ 铃声文件", null);    // 设置自定义铃声

            nm.createNotificationChannel(notificationChannel);
        }
    }
}
gptbots-widget