fix:修复房间前台服务-通知兼容异常问题
This commit is contained in:
@@ -92,7 +92,13 @@ public class DaemonService extends Service {
|
|||||||
builder.setTicker(ResUtil.getString(R.string.erban_service_daemonservice_06));
|
builder.setTicker(ResUtil.getString(R.string.erban_service_daemonservice_06));
|
||||||
//8.0系统适配
|
//8.0系统适配
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
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());
|
startForeground(NOTICE_ID, builder.build());
|
||||||
isStartForeground = true;
|
isStartForeground = true;
|
||||||
|
Reference in New Issue
Block a user