fix:修复房间前台服务-通知兼容异常问题

This commit is contained in:
max
2024-04-29 10:15:22 +08:00
parent 1d399777b1
commit 6e37bd9c68

View File

@@ -92,7 +92,13 @@ public class DaemonService extends Service {
builder.setTicker(ResUtil.getString(R.string.erban_service_daemonservice_06));
//8.0系统适配
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(CHANNEL_ID);
String channelID = getPackageName() + "1";
String channelName = ResUtil.getString(R.string.erban_service_daemonservice_04);
NotificationChannel channel = new NotificationChannel(channelID, channelName, NotificationManager.IMPORTANCE_HIGH);
channel.setSound(null, null);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
builder.setChannelId(channelID);
}
startForeground(NOTICE_ID, builder.build());
isStartForeground = true;