通知声音和振动在android 8.1中不起作用

通知声音和振动在android 8.1中不起作用,android,kotlin,notifications,Android,Kotlin,Notifications,这是我的密码 val intent = Intent("com.sbs16.ensofia.OPEN") //intent.putExtra(MSDConstants.ACTIVITY_NOTIFICATION_TYPE, mType) //intent.putExtra(MSDConstants.ACTIVITY_NOTIFICATION_ID, mId) //intent.

这是我的密码

val intent = Intent("com.sbs16.ensofia.OPEN")
                    //intent.putExtra(MSDConstants.ACTIVITY_NOTIFICATION_TYPE, mType)
                    //intent.putExtra(MSDConstants.ACTIVITY_NOTIFICATION_ID, mId)
                    //intent.putExtra(MSDConstants.ACTIVITY_NOTIFICATION_URL, mUrl)
                    val pendingIntent = PendingIntent.getBroadcast(applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)

                    val notificationBuilder =
                        NotificationCompat.Builder(this, getString(R.string.notification_channel_id))
                            .setContentTitle(getString(R.string.app_name))
                            .setContentText(body)
                            .setContentIntent(pendingIntent)
                            .setAutoCancel(true)
                            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                            .setLargeIcon(BitmapFactory.decodeResource(resources, R.drawable.icon_notifications))
                            .setColor(resources.getColor(R.color.red))
                            .setLights(Color.RED, 1000, 300)
                            .setDefaults(Notification.DEFAULT_VIBRATE)
                            .setSmallIcon(R.drawable.icon_notifications)


                    var notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {

                        val importance = NotificationManager.IMPORTANCE_DEFAULT
                        val id = getString(R.string.notification_channel_id)
                        val name = getString(R.string.notification_channel_name)
                        val description = getString(R.string.notification_channel_description)
                        val channel = NotificationChannel(id, name, importance)
                        channel.description = description
                        channel.enableLights(true);
                        channel.lightColor = Color.RED;
                        channel.enableVibration(true);

                        notificationManager.createNotificationChannel(channel)
                    }
                    notificationManager.notify(0, notificationBuilder.build())

是仅声音和振动还是整个通知?否收到通知但图标不显示在状态栏中,android 8中没有声音或振动是仅声音和振动还是整个通知?否收到通知但图标不显示在状态栏中,android 8中没有声音或振动